Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 21 pull requests #35407

Merged
merged 40 commits into from
Aug 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c622a42
Update the man page rustc.1
dns2utf8 Aug 4, 2016
91f9704
Update rustdoc version
dns2utf8 Aug 4, 2016
a6c9404
run rustfmt on librustc_passes folder
srinivasreddy Jul 21, 2016
8787237
Add E0254 error explanation
GuillaumeGomez Aug 4, 2016
8641bc2
Updated E0081 to new format
Aug 5, 2016
c61cfb0
Update E0106 error message to new format.
Tiwalun Aug 5, 2016
764d5cf
Update E0379 to new format #35338
kc1212 Aug 5, 2016
7cd1779
Add new error code tests
GuillaumeGomez Aug 5, 2016
bc25879
Update E0207 to use struct_span_err, add span_label
shantanuraj Aug 5, 2016
5eebb92
Update error message for E0166
Aug 5, 2016
b7468fa
Updated E0306 to new format.
razielgn Aug 5, 2016
40b7ace
Update E0229 to new format
Aug 5, 2016
3575812
Update E0107 message to new format
ojsheikh Aug 5, 2016
00179a7
Updated style of unit test
Aug 5, 2016
7eca647
Update error format for E0373
trixnz Aug 5, 2016
2061d65
Add E0107 tests for multiple lifetime params
ojsheikh Aug 5, 2016
51a270f
Fix E0229 unit tests
Aug 5, 2016
291b6f1
Comment on the casts in the `seek` implementations on files
tbu- Jul 18, 2016
58b618e
Update unit tests to accord for label in E0207
shantanuraj Aug 5, 2016
422e0d5
Update E0004 to use labels
TheZoq2 Aug 5, 2016
e0035c9
Update error message for E0323, E0324 and E0325
Aug 5, 2016
da2b7a6
Clean up `std::raw` docs
apasel422 Aug 4, 2016
1cf5142
Updated error format for E0069
jaredadobe Aug 5, 2016
8e04264
Rollup merge of #33951 - srinivasreddy:librust_pass_rustfmt, r=nikoma…
eddyb Aug 6, 2016
68f7b26
Rollup merge of #34916 - tbu-:pr_comment_on_seek_cast, r=GuillaumeGomez
eddyb Aug 6, 2016
c1fe071
Rollup merge of #35281 - apasel422:repr, r=GuillaumeGomez
eddyb Aug 6, 2016
d9cc84b
Rollup merge of #35287 - dns2utf8:man_page_rustc, r=nikomatsakis
eddyb Aug 6, 2016
bb1ff9d
Rollup merge of #35288 - Roybie:35271-E0166-update-error-format, r=Gu…
eddyb Aug 6, 2016
8e1b96a
Rollup merge of #35351 - jaredwy:update-error-69, r=jonathandturner
eddyb Aug 6, 2016
b9c5fa4
Rollup merge of #35353 - poveda-ruiz:master, r=jonathandturner
eddyb Aug 6, 2016
75c86ca
Rollup merge of #35356 - Tiwalun:fix-err-msg-e0106, r=jonathandturner
eddyb Aug 6, 2016
c846c30
Rollup merge of #35363 - GuillaumeGomez:err_codes, r=jonathandturner
eddyb Aug 6, 2016
a7b7417
Rollup merge of #35364 - kc1212:e0379, r=jonathandturner
eddyb Aug 6, 2016
8747b5b
Rollup merge of #35368 - shantanuraj:master, r=jonathandturner
eddyb Aug 6, 2016
b722358
Rollup merge of #35370 - razielgn:updated-e0306-to-new-format, r=jona…
eddyb Aug 6, 2016
aba49ac
Rollup merge of #35372 - Keats:err-323, r=jonathandturner
eddyb Aug 6, 2016
b053da3
Rollup merge of #35373 - oijazsh:E0107, r=jonathandturner
eddyb Aug 6, 2016
77c342e
Rollup merge of #35374 - mrabault:e0229_format, r=jonathandturner
eddyb Aug 6, 2016
56cadb6
Rollup merge of #35376 - trixnz:update-error-373, r=jonathandturner
eddyb Aug 6, 2016
67f0822
Rollup merge of #35380 - TheZoq2:master, r=jonathandturner
eddyb Aug 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions man/rustc.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH RUSTC "1" "August 2015" "rustc 1.2.0" "User Commands"
.TH RUSTC "1" "August 2016" "rustc 1.12.0" "User Commands"
.SH NAME
rustc \- The Rust compiler
.SH SYNOPSIS
Expand Down Expand Up @@ -299,7 +299,7 @@ To build an executable with debug info:
See https://github.com/rust\-lang/rust/issues for issues.

.SH "AUTHOR"
See \fIAUTHORS.txt\fR in the Rust source distribution.
See https://github.com/rust\-lang/rust/graphs/contributors or use `git log --all --format='%cN <%cE>' | sort -u` in the rust source distribution.

.SH "COPYRIGHT"
This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
Expand Down
2 changes: 1 addition & 1 deletion man/rustdoc.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH RUSTDOC "1" "August 2015" "rustdoc 1.2.0" "User Commands"
.TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands"
.SH NAME
rustdoc \- generate documentation from Rust source code
.SH SYNOPSIS
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
/// only designed to be used by unsafe code that needs to manipulate
/// the low-level details.
///
/// There is no `Repr` implementation for `TraitObject` because there
/// is no way to refer to all trait objects generically, so the only
/// There is no way to refer to all trait objects generically, so the only
/// way to create values of this type is with functions like
/// `std::mem::transmute`. Similarly, the only way to create a true
/// [`std::mem::transmute`][transmute]. Similarly, the only way to create a true
/// trait object from a `TraitObject` value is with `transmute`.
///
/// [transmute]: ../intrinsics/fn.transmute.html
///
/// Synthesizing a trait object with mismatched types—one where the
/// vtable does not correspond to the type of the value to which the
/// data pointer points—is highly likely to lead to undefined
Expand All @@ -50,13 +51,13 @@
/// ```
/// #![feature(raw)]
///
/// use std::mem;
/// use std::raw;
/// use std::{mem, raw};
///
/// // an example trait
/// trait Foo {
/// fn bar(&self) -> i32;
/// }
///
/// impl Foo for i32 {
/// fn bar(&self) -> i32 {
/// *self + 1
Expand All @@ -74,19 +75,18 @@
/// // the data pointer is the address of `value`
/// assert_eq!(raw_object.data as *const i32, &value as *const _);
///
///
/// let other_value: i32 = 456;
///
/// // construct a new object, pointing to a different `i32`, being
/// // careful to use the `i32` vtable from `object`
/// let synthesized: &Foo = unsafe {
/// mem::transmute(raw::TraitObject {
/// data: &other_value as *const _ as *mut (),
/// vtable: raw_object.vtable
/// vtable: raw_object.vtable,
/// })
/// };
///
/// // it should work just like we constructed a trait object out of
/// // it should work just as if we had constructed a trait object out of
/// // `other_value` directly
/// assert_eq!(synthesized.bar(), 457);
/// ```
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/middle/astconv_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

pub fn prohibit_projection(self, span: Span)
{
span_err!(self.sess, span, E0229,
"associated type bindings are not allowed here");
let mut err = struct_span_err!(self.sess, span, E0229,
"associated type bindings are not allowed here");
err.span_label(span, &format!("associate type not allowed here")).emit();
}

pub fn prim_ty_to_ty(self,
Expand Down
5 changes: 4 additions & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
but it borrows {}, \
which is owned by the current function",
cmt_path_or_string)
.span_note(capture_span,
.span_label(capture_span,
&format!("{} is borrowed here",
cmt_path_or_string))
.span_label(err.span,
&format!("may outlive borrowed value {}",
cmt_path_or_string))
.span_suggestion(err.span,
&format!("to force the closure to take ownership of {} \
(and any other referenced variables), \
Expand Down
9 changes: 7 additions & 2 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,15 @@ fn check_exhaustive<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>,
format!("`{}` and {} more", head.join("`, `"), tail.len())
}
};
span_err!(cx.tcx.sess, sp, E0004,

let label_text = match pattern_strings.len(){
1 => format!("pattern {} not covered", joined_patterns),
_ => format!("patterns {} not covered", joined_patterns)
};
struct_span_err!(cx.tcx.sess, sp, E0004,
"non-exhaustive patterns: {} not covered",
joined_patterns
);
).span_label(sp, &label_text).emit();
},
}
}
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_const_eval/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,10 +1337,13 @@ pub fn eval_length<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
Ok(val as usize)
},
Ok(const_val) => {
span_err!(tcx.sess, count_expr.span, E0306,
"expected usize for {}, found {}",
reason,
const_val.description());
struct_span_err!(tcx.sess, count_expr.span, E0306,
"expected `usize` for {}, found {}",
reason,
const_val.description())
.span_label(count_expr.span, &format!("expected `usize`"))
.emit();

Err(ErrorReported)
}
Err(err) => {
Expand Down
101 changes: 60 additions & 41 deletions src/librustc_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ impl<'a> AstValidator<'a> {
self.err_handler().span_err(span, &format!("invalid label name `{}`", label.name));
}
if label.name.as_str() == "'_" {
self.session.add_lint(
lint::builtin::LIFETIME_UNDERSCORE, id, span,
format!("invalid label name `{}`", label.name)
);
self.session.add_lint(lint::builtin::LIFETIME_UNDERSCORE,
id,
span,
format!("invalid label name `{}`", label.name));
}
}

fn invalid_visibility(&self, vis: &Visibility, span: Span, note: Option<&str>) {
if vis != &Visibility::Inherited {
let mut err = struct_span_err!(self.session, span, E0449,
let mut err = struct_span_err!(self.session,
span,
E0449,
"unnecessary visibility qualifier");
if let Some(note) = note {
err.span_note(span, note);
Expand All @@ -71,20 +73,23 @@ impl<'a> AstValidator<'a> {
impl<'a> Visitor for AstValidator<'a> {
fn visit_lifetime(&mut self, lt: &Lifetime) {
if lt.name.as_str() == "'_" {
self.session.add_lint(
lint::builtin::LIFETIME_UNDERSCORE, lt.id, lt.span,
format!("invalid lifetime name `{}`", lt.name)
);
self.session.add_lint(lint::builtin::LIFETIME_UNDERSCORE,
lt.id,
lt.span,
format!("invalid lifetime name `{}`", lt.name));
}

visit::walk_lifetime(self, lt)
}

fn visit_expr(&mut self, expr: &Expr) {
match expr.node {
ExprKind::While(_, _, Some(ident)) | ExprKind::Loop(_, Some(ident)) |
ExprKind::WhileLet(_, _, _, Some(ident)) | ExprKind::ForLoop(_, _, _, Some(ident)) |
ExprKind::Break(Some(ident)) | ExprKind::Continue(Some(ident)) => {
ExprKind::While(_, _, Some(ident)) |
ExprKind::Loop(_, Some(ident)) |
ExprKind::WhileLet(_, _, _, Some(ident)) |
ExprKind::ForLoop(_, _, _, Some(ident)) |
ExprKind::Break(Some(ident)) |
ExprKind::Continue(Some(ident)) => {
self.check_label(ident.node, ident.span, expr.id);
}
_ => {}
Expand All @@ -97,10 +102,13 @@ impl<'a> Visitor for AstValidator<'a> {
match ty.node {
TyKind::BareFn(ref bfty) => {
self.check_decl_no_pat(&bfty.decl, |span, _| {
let mut err = struct_span_err!(self.session, span, E0561,
"patterns aren't allowed in function pointer types");
err.span_note(span, "this is a recent error, see \
issue #35203 for more details");
let mut err = struct_span_err!(self.session,
span,
E0561,
"patterns aren't allowed in function pointer \
types");
err.span_note(span,
"this is a recent error, see issue #35203 for more details");
err.emit();
});
}
Expand All @@ -114,10 +122,10 @@ impl<'a> Visitor for AstValidator<'a> {
if path.global && path.segments.len() > 0 {
let ident = path.segments[0].identifier;
if token::Ident(ident).is_path_segment_keyword() {
self.session.add_lint(
lint::builtin::SUPER_OR_SELF_IN_GLOBAL_PATH, id, path.span,
format!("global paths cannot start with `{}`", ident)
);
self.session.add_lint(lint::builtin::SUPER_OR_SELF_IN_GLOBAL_PATH,
id,
path.span,
format!("global paths cannot start with `{}`", ident));
}
}

Expand All @@ -129,8 +137,8 @@ impl<'a> Visitor for AstValidator<'a> {
ItemKind::Use(ref view_path) => {
let path = view_path.node.path();
if !path.segments.iter().all(|segment| segment.parameters.is_empty()) {
self.err_handler().span_err(path.span, "type or lifetime parameters \
in import path");
self.err_handler()
.span_err(path.span, "type or lifetime parameters in import path");
}
}
ItemKind::Impl(_, _, _, Some(..), _, ref impl_items) => {
Expand All @@ -140,15 +148,18 @@ impl<'a> Visitor for AstValidator<'a> {
}
}
ItemKind::Impl(_, _, _, None, _, _) => {
self.invalid_visibility(&item.vis, item.span, Some("place qualifiers on individual \
impl items instead"));
self.invalid_visibility(&item.vis,
item.span,
Some("place qualifiers on individual impl items instead"));
}
ItemKind::DefaultImpl(..) => {
self.invalid_visibility(&item.vis, item.span, None);
}
ItemKind::ForeignMod(..) => {
self.invalid_visibility(&item.vis, item.span, Some("place qualifiers on individual \
foreign items instead"));
self.invalid_visibility(&item.vis,
item.span,
Some("place qualifiers on individual foreign items \
instead"));
}
ItemKind::Enum(ref def, _) => {
for variant in &def.variants {
Expand All @@ -167,11 +178,14 @@ impl<'a> Visitor for AstValidator<'a> {
match fi.node {
ForeignItemKind::Fn(ref decl, _) => {
self.check_decl_no_pat(decl, |span, is_recent| {
let mut err = struct_span_err!(self.session, span, E0130,
"patterns aren't allowed in foreign function declarations");
let mut err = struct_span_err!(self.session,
span,
E0130,
"patterns aren't allowed in foreign function \
declarations");
if is_recent {
err.span_note(span, "this is a recent error, see \
issue #35203 for more details");
err.span_note(span,
"this is a recent error, see issue #35203 for more details");
}
err.emit();
});
Expand All @@ -182,16 +196,21 @@ impl<'a> Visitor for AstValidator<'a> {
visit::walk_foreign_item(self, fi)
}

fn visit_variant_data(&mut self, vdata: &VariantData, _: Ident,
_: &Generics, _: NodeId, span: Span) {
fn visit_variant_data(&mut self,
vdata: &VariantData,
_: Ident,
_: &Generics,
_: NodeId,
span: Span) {
if vdata.fields().is_empty() {
if vdata.is_tuple() {
self.err_handler().struct_span_err(span, "empty tuple structs and enum variants \
are not allowed, use unit structs and \
enum variants instead")
.span_help(span, "remove trailing `()` to make a unit \
struct or unit enum variant")
.emit();
self.err_handler()
.struct_span_err(span,
"empty tuple structs and enum variants are not allowed, use \
unit structs and enum variants instead")
.span_help(span,
"remove trailing `()` to make a unit struct or unit enum variant")
.emit();
}
}

Expand All @@ -200,10 +219,10 @@ impl<'a> Visitor for AstValidator<'a> {

fn visit_vis(&mut self, vis: &Visibility) {
match *vis {
Visibility::Restricted{ref path, ..} => {
Visibility::Restricted { ref path, .. } => {
if !path.segments.iter().all(|segment| segment.parameters.is_empty()) {
self.err_handler().span_err(path.span, "type or lifetime parameters \
in visibility path");
self.err_handler()
.span_err(path.span, "type or lifetime parameters in visibility path");
}
}
_ => {}
Expand Down
Loading