Skip to content

Commit

Permalink
Rollup merge of rust-lang#35359 - Archytaus:master, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Updated E0391 and E0404 to new error format

Fixes rust-lang#35341 and rust-lang#35342 as part of rust-lang#35233.

r? @GuillaumeGomez
  • Loading branch information
GuillaumeGomez authored Aug 5, 2016
2 parents dbef510 + 19e140b commit cd48161
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
name)
}
ResolutionError::IsNotATrait(name) => {
struct_span_err!(resolver.session, span, E0404, "`{}` is not a trait", name)
let mut err = struct_span_err!(resolver.session,
span,
E0404,
"`{}` is not a trait",
name);
err.span_label(span, &format!("not a trait"));
err
}
ResolutionError::UndeclaredTraitName(name, candidates) => {
let mut err = struct_span_err!(resolver.session,
Expand Down
1 change: 1 addition & 0 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ impl<'a,'tcx> CrateCtxt<'a,'tcx> {

let mut err = struct_span_err!(tcx.sess, span, E0391,
"unsupported cyclic reference between types/traits detected");
err.span_label(span, &format!("cyclic reference"));

match cycle[0] {
AstConvRequest::GetItemTypeScheme(def_id) |
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-3907.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct S {
}

impl Foo for S { //~ ERROR: `Foo` is not a trait
//~| NOTE: not a trait
//~| NOTE: type aliases cannot be used for traits
fn bar() { }
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-5035.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
trait I {}
type K = I;
impl K for isize {} //~ ERROR: `K` is not a trait
//~| NOTE: not a trait
//~| NOTE: aliases cannot be used for traits

use ImportError; //~ ERROR unresolved
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/codemap_tests/two_files.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0404]: `Bar` is not a trait
--> $DIR/two_files.rs:16:6
|
16 | impl Bar for Baz { }
| ^^^
| ^^^ not a trait
|
= note: type aliases cannot be used for traits

Expand Down

0 comments on commit cd48161

Please sign in to comment.