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 12 pull requests #35652

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
127489a
Update compiler error 0093 to use new error format
stanislav-tkach Aug 9, 2016
1a6fac7
E0248 Change in issue format
shyamsundarb-arch Aug 7, 2016
5c2c19a
Update error message for E0253 #35512
lukehinds Aug 9, 2016
c974749
Update E0253.rs
lukehinds Aug 10, 2016
92f7e85
Update E0138 to new format
wdv4758h Aug 10, 2016
b9762f8
Update E0033 to the new error format
munyari Aug 8, 2016
1c37892
Update E0220 message to new format
chamoysvoice Aug 6, 2016
80beeb3
Add additional error note
munyari Aug 11, 2016
4209f94
Add label to E0254
tvladyslav Aug 10, 2016
c761184
Fix tidy tests
tvladyslav Aug 11, 2016
4ab00e4
updated E0070 to new error format
clementmiao Aug 12, 2016
302a423
Update E0301 to the new format
krzysztofgarczynski Aug 12, 2016
5402d28
Update E0302 to the new format
krzysztofgarczynski Aug 13, 2016
bd90a16
updated E0067 to new error format
clementmiao Aug 13, 2016
85388f0
E0094 error message updated
theypsilon Aug 13, 2016
58738a9
Rollup merge of #35346 - DarkEld3r:e0093-formatting, r=jonathandturner
Aug 13, 2016
c71662c
Rollup merge of #35412 - chamoysvoice:e0220, r=jonathandturner
Aug 13, 2016
dd26a38
Rollup merge of #35526 - munyari:e0033, r=jonathandturner
Aug 13, 2016
7d4cc15
Rollup merge of #35558 - lukehinds:master, r=nikomatsakis
Aug 13, 2016
0d7927d
Rollup merge of #35573 - wdv4758h:E0138, r=jonathandturner
Aug 13, 2016
d58a53d
Rollup merge of #35586 - shyaamsundhar:SqushCom, r=jonathandturner
Aug 13, 2016
229b98d
Rollup merge of #35596 - crypto-universe:E0254_style_and_tests, r=jon…
Aug 13, 2016
a2e88ad
Rollup merge of #35615 - clementmiao:E0070_new_error_format, r=jonath…
Aug 13, 2016
9c704cc
Rollup merge of #35616 - clementmiao:E0067_new_error_format, r=jonath…
Aug 13, 2016
a7865b6
Rollup merge of #35643 - garekkream:update-E0301-new-error-format, r=…
Aug 13, 2016
4b13676
Rollup merge of #35644 - garekkream:update-E0302-new-error-format, r=…
Aug 13, 2016
913d2f7
Rollup merge of #35646 - theypsilon:master, r=jonathandturner
Aug 13, 2016
5e9dc84
Fix tidy warning
Aug 13, 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
9 changes: 7 additions & 2 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
if ctxt.start_fn.is_none() {
ctxt.start_fn = Some((item.id, item.span));
} else {
span_err!(ctxt.session, item.span, E0138,
"multiple 'start' functions");
struct_span_err!(
ctxt.session, item.span, E0138,
"multiple 'start' functions")
.span_label(ctxt.start_fn.unwrap().1,
&format!("previous `start` function here"))
.span_label(item.span, &format!("multiple `start` functions"))
.emit();
}
},
EntryPointType::None => ()
Expand Down
8 changes: 6 additions & 2 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,10 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
_: LoanCause) {
match kind {
MutBorrow => {
span_err!(self.cx.tcx.sess, span, E0301,
struct_span_err!(self.cx.tcx.sess, span, E0301,
"cannot mutably borrow in a pattern guard")
.span_label(span, &format!("borrowed mutably in pattern guard"))
.emit();
}
ImmBorrow | UniqueImmBorrow => {}
}
Expand All @@ -1185,7 +1187,9 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
fn mutate(&mut self, _: NodeId, span: Span, _: cmt, mode: MutateMode) {
match mode {
MutateMode::JustWrite | MutateMode::WriteAndRead => {
span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
.span_label(span, &format!("assignment in pattern guard"))
.emit();
}
MutateMode::Init => {}
}
Expand Down
8 changes: 6 additions & 2 deletions src/librustc_passes/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ impl<'a> CheckLoopVisitor<'a> {
match self.cx {
Loop => {}
Closure => {
span_err!(self.sess, span, E0267, "`{}` inside of a closure", name);
struct_span_err!(self.sess, span, E0267, "`{}` inside of a closure", name)
.span_label(span, &format!("cannot break inside of a closure"))
.emit();
}
Normal => {
span_err!(self.sess, span, E0268, "`{}` outside of loop", name);
struct_span_err!(self.sess, span, E0268, "`{}` outside of loop", name)
.span_label(span, &format!("cannot break outside of a loop"))
.emit();
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3374,8 +3374,11 @@ impl<'a> Resolver<'a> {

let mut err = match (old_binding.is_extern_crate(), binding.is_extern_crate()) {
(true, true) => struct_span_err!(self.session, span, E0259, "{}", msg),
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() =>
struct_span_err!(self.session, span, E0254, "{}", msg),
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() => {
let mut e = struct_span_err!(self.session, span, E0254, "{}", msg);
e.span_label(span, &"already imported");
e
},
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
_ => match (old_binding.is_import(), binding.is_import()) {
(false, false) => struct_span_err!(self.session, span, E0428, "{}", msg),
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
}
Success(binding) if !binding.is_importable() => {
let msg = format!("`{}` is not directly importable", target);
span_err!(self.session, directive.span, E0253, "{}", &msg);
struct_span_err!(self.session, directive.span, E0253, "{}", &msg)
.span_label(directive.span, &format!("cannot be imported directly"))
.emit();
// Do not import this illegal binding. Import a dummy binding and pretend
// everything is fine
self.import_dummy_binding(module, directive);
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,10 +1285,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
-> Result<ty::PolyTraitRef<'tcx>, ErrorReported>
{
if bounds.is_empty() {
span_err!(self.tcx().sess, span, E0220,
"associated type `{}` not found for `{}`",
assoc_name,
ty_param_name);
struct_span_err!(self.tcx().sess, span, E0220,
"associated type `{}` not found for `{}`",
assoc_name,
ty_param_name)
.span_label(span, &format!("associated type `{}` not found",
assoc_name))
.emit();
return Err(ErrorReported);
}

Expand Down
8 changes: 5 additions & 3 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if let ty::TyTrait(..) = mt.ty.sty {
// This is "x = SomeTrait" being reduced from
// "let &x = &SomeTrait" or "let box x = Box<SomeTrait>", an error.
span_err!(self.tcx.sess, span, E0033,
"type `{}` cannot be dereferenced",
self.ty_to_string(expected));
let type_str = self.ty_to_string(expected);
struct_span_err!(self.tcx.sess, span, E0033,
"type `{}` cannot be dereferenced", type_str)
.span_label(span, &format!("type `{}` cannot be dereferenced", type_str))
.emit();
return false
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/librustc_typeck/check/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ fn equate_intrinsic_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
}));
let i_n_tps = i_ty.generics.types.len(subst::FnSpace);
if i_n_tps != n_tps {
span_err!(tcx.sess, it.span, E0094,
struct_span_err!(tcx.sess, it.span, E0094,
"intrinsic has wrong number of type \
parameters: found {}, expected {}",
i_n_tps, n_tps);
i_n_tps, n_tps)
.span_label(it.span, &format!("expected {} type parameter", n_tps))
.emit();
} else {
require_same_types(ccx,
TypeOrigin::IntrinsicType(it.span),
Expand Down Expand Up @@ -299,8 +301,11 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
}

ref other => {
span_err!(tcx.sess, it.span, E0093,
"unrecognized intrinsic function: `{}`", *other);
struct_span_err!(tcx.sess, it.span, E0093,
"unrecognized intrinsic function: `{}`",
*other)
.span_label(it.span, &format!("unrecognized intrinsic"))
.emit();
return;
}
};
Expand Down
9 changes: 7 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3520,8 +3520,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {

let tcx = self.tcx;
if !tcx.expr_is_lval(&lhs) {
span_err!(tcx.sess, expr.span, E0070,
"invalid left-hand side expression");
struct_span_err!(
tcx.sess, expr.span, E0070,
"invalid left-hand side expression")
.span_label(
expr.span,
&format!("left-hand of expression not valid"))
.emit();
}

let lhs_ty = self.expr_ty(&lhs);
Expand Down
8 changes: 7 additions & 1 deletion src/librustc_typeck/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {

let tcx = self.tcx;
if !tcx.expr_is_lval(lhs_expr) {
span_err!(tcx.sess, lhs_expr.span, E0067, "invalid left-hand side expression");
struct_span_err!(
tcx.sess, lhs_expr.span,
E0067, "invalid left-hand side expression")
.span_label(
lhs_expr.span,
&format!("invalid expression for left-hand side"))
.emit();
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/test/compile-fail/E0033.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ trait SomeTrait {

fn main() {
let trait_obj: &SomeTrait = SomeTrait; //~ ERROR E0425
//~^ ERROR E0038
let &invalid = trait_obj; //~ ERROR E0033
//~^ ERROR E0038
//~| method `foo` has no receiver
//~| NOTE the trait `SomeTrait` cannot be made into an object

let &invalid = trait_obj;
//~^ ERROR E0033
//~| NOTE type `&SomeTrait` cannot be dereferenced
}
2 changes: 2 additions & 0 deletions src/test/compile-fail/E0067.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ use std::collections::LinkedList;
fn main() {
LinkedList::new() += 1; //~ ERROR E0368
//~^ ERROR E0067
//~^^ NOTE invalid expression for left-hand side
//~| NOTE cannot use `+=` on type `std::collections::LinkedList<_>`
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0093.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

#![feature(intrinsics)]
extern "rust-intrinsic" {
fn foo(); //~ ERROR E0093
fn foo();
//~^ ERROR E0093
//~| NOTE unrecognized intrinsic
}

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0094.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn size_of<T, U>() -> usize; //~ ERROR E0094
//~| NOTE expected 1 type parameter
}

fn main() {
Expand Down
5 changes: 4 additions & 1 deletion src/test/compile-fail/E0138.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

#[start]
fn foo(argc: isize, argv: *const *const u8) -> isize {}
//~^ NOTE previous `start` function here

#[start]
fn f(argc: isize, argv: *const *const u8) -> isize {} //~ ERROR E0138
fn f(argc: isize, argv: *const *const u8) -> isize {}
//~^ ERROR E0138
//~| NOTE multiple `start` functions
1 change: 1 addition & 0 deletions src/test/compile-fail/E0220.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ trait Trait {
}

type Foo = Trait<F=i32>; //~ ERROR E0220
//~| NOTE associated type `F` not found
//~^ ERROR E0191

fn main() {
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0253.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ mod foo {
}
}

use foo::MyTrait::do_something; //~ ERROR E0253
use foo::MyTrait::do_something;
//~^ ERROR E0253
//~|NOTE cannot be imported directly

fn main() {}
5 changes: 4 additions & 1 deletion src/test/compile-fail/E0254.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
// except according to those terms.

extern crate collections;
//~^ NOTE previous import of `collections` here

mod foo {
pub trait collections {
fn do_something();
}
}

use foo::collections; //~ ERROR E0254
use foo::collections;
//~^ ERROR E0254
//~| NOTE already imported

fn main() {}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0267.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

fn main() {
let w = || { break; }; //~ ERROR E0267
//~| NOTE cannot break inside of a closure
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0268.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

fn main() {
break; //~ ERROR E0268
//~| NOTE cannot break outside of a loop
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0301.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if option.take().is_none() => {}, //~ ERROR E0301
//~| NOTE borrowed mutably in pattern guard
Some(_) => { }
}
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0302.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if { option = None; false } => { }, //~ ERROR E0302
//~| NOTE assignment in pattern guard
Some(_) => { }
}
}
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-26093.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ macro_rules! not_an_lvalue {
($thing:expr) => {
$thing = 42;
//~^ ERROR invalid left-hand side expression
//~^^ NOTE left-hand of expression not valid
}
}

Expand Down