Rollup merge of #35359 - Archytaus:master, r=GuillaumeGomez

Updated E0391 and E0404 to new error format

Fixes #35341 and #35342 as part of #35233.

r? @GuillaumeGomez
This commit is contained in:
Guillaume Gomez 2016-08-05 16:13:00 +02:00 committed by GitHub
commit cd48161e2c
5 changed files with 11 additions and 2 deletions

View File

@ -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,

View File

@ -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) |

View File

@ -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() { }
}

View File

@ -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

View File

@ -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