From 065c685e80930379ada8c4358cdd69c2c99ebb15 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 5 Aug 2016 20:41:25 -0700 Subject: [PATCH] Update E0223 to the new format --- src/librustc_typeck/astconv.rs | 10 ++++++---- src/test/compile-fail/E0223.rs | 5 ++++- .../associated-types-in-ambiguous-context.rs | 6 ++++++ src/test/compile-fail/issue-34209.rs | 4 +++- src/test/compile-fail/qualified-path-params-2.rs | 8 ++++++-- src/test/compile-fail/self-impl.rs | 8 ++++++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index a11df5ae05d6f..953c6b56948cb 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1211,10 +1211,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { type_str: &str, trait_str: &str, name: &str) { - span_err!(self.tcx().sess, span, E0223, - "ambiguous associated type; specify the type using the syntax \ - `<{} as {}>::{}`", - type_str, trait_str, name); + struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type") + .span_label(span, &format!("ambiguous associated type")) + .note(&format!("specify the type using the syntax `<{} as {}>::{}`", + type_str, trait_str, name)) + .emit(); + } // Search for a bound on a type parameter which includes the associated item diff --git a/src/test/compile-fail/E0223.rs b/src/test/compile-fail/E0223.rs index bbf7d762ef00b..56057b372599d 100644 --- a/src/test/compile-fail/E0223.rs +++ b/src/test/compile-fail/E0223.rs @@ -11,5 +11,8 @@ trait MyTrait { type X; } fn main() { - let foo: MyTrait::X; //~ ERROR E0223 + let foo: MyTrait::X; + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::X` } diff --git a/src/test/compile-fail/associated-types-in-ambiguous-context.rs b/src/test/compile-fail/associated-types-in-ambiguous-context.rs index becbc27138b77..ff886e63dc59e 100644 --- a/src/test/compile-fail/associated-types-in-ambiguous-context.rs +++ b/src/test/compile-fail/associated-types-in-ambiguous-context.rs @@ -15,15 +15,21 @@ trait Get { fn get(x: T, y: U) -> Get::Value {} //~^ ERROR ambiguous associated type +//~| NOTE ambiguous associated type +//~| NOTE specify the type using the syntax `::Value` trait Grab { type Value; fn grab(&self) -> Grab::Value; //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::Value` } type X = std::ops::Deref::Target; //~^ ERROR ambiguous associated type +//~| NOTE ambiguous associated type +//~| NOTE specify the type using the syntax `::Target` fn main() { } diff --git a/src/test/compile-fail/issue-34209.rs b/src/test/compile-fail/issue-34209.rs index 6fae18dec10a6..5e3b777cc0b62 100644 --- a/src/test/compile-fail/issue-34209.rs +++ b/src/test/compile-fail/issue-34209.rs @@ -15,7 +15,9 @@ enum S { fn bug(l: S) { match l { S::B{ } => { }, - //~^ ERROR ambiguous associated type; specify the type using the syntax `::B` + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::B` } } diff --git a/src/test/compile-fail/qualified-path-params-2.rs b/src/test/compile-fail/qualified-path-params-2.rs index 5c661bfcdc0c9..e685ebc272098 100644 --- a/src/test/compile-fail/qualified-path-params-2.rs +++ b/src/test/compile-fail/qualified-path-params-2.rs @@ -25,7 +25,11 @@ impl S { fn f() {} } -type A = ::A::f; //~ ERROR type parameters are not allowed on this type -//~^ ERROR ambiguous associated type; specify the type using the syntax `<::A as Trait>::f` +type A = ::A::f; +//~^ ERROR type parameters are not allowed on this type +//~| NOTE type parameter not allowed +//~| ERROR ambiguous associated type +//~| NOTE ambiguous associated type +//~| NOTE specify the type using the syntax `<::A as Trait>::f` fn main() {} diff --git a/src/test/compile-fail/self-impl.rs b/src/test/compile-fail/self-impl.rs index d058c6a5a3b93..860e69fcaec4d 100644 --- a/src/test/compile-fail/self-impl.rs +++ b/src/test/compile-fail/self-impl.rs @@ -31,9 +31,13 @@ impl SuperFoo for Bar { impl Bar { fn f() { let _: ::Baz = true; -//~^ERROR: ambiguous associated type; specify the type using the syntax `::Baz` + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::Baz` let _: Self::Baz = true; -//~^ERROR: ambiguous associated type; specify the type using the syntax `::Baz` + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::Baz` } }