]> git.lizzy.rs Git - rust.git/commitdiff
Update E0223 to the new format
authorKeith Yeung <kungfukeith11@gmail.com>
Sat, 6 Aug 2016 03:41:25 +0000 (20:41 -0700)
committerKeith Yeung <kungfukeith11@gmail.com>
Sat, 6 Aug 2016 04:31:18 +0000 (21:31 -0700)
src/librustc_typeck/astconv.rs
src/test/compile-fail/E0223.rs
src/test/compile-fail/associated-types-in-ambiguous-context.rs
src/test/compile-fail/issue-34209.rs
src/test/compile-fail/qualified-path-params-2.rs
src/test/compile-fail/self-impl.rs

index a11df5ae05d6fca6e56f74db4e67c04ede6d847a..953c6b56948cb194480fef7d6a5a8c5273b9a1c7 100644 (file)
@@ -1211,10 +1211,12 @@ fn report_ambiguous_associated_type(&self,
                                         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
index bbf7d762ef00bb3e1fcb16915aa9487fc4cde1a6..56057b372599dc284593b08489ae84eeab283dd1 100644 (file)
@@ -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 `<Type as MyTrait>::X`
 }
index becbc27138b770e700d524844357252c7c017c95..ff886e63dc59ef1aebab668fe16ce51d5edcd29c 100644 (file)
@@ -15,15 +15,21 @@ trait Get {
 
 fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
 //~^ ERROR ambiguous associated type
+//~| NOTE ambiguous associated type
+//~| NOTE specify the type using the syntax `<Type as Get>::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 `<Type as Grab>::Value`
 }
 
 type X = std::ops::Deref::Target;
 //~^ ERROR ambiguous associated type
+//~| NOTE ambiguous associated type
+//~| NOTE specify the type using the syntax `<Type as std::ops::Deref>::Target`
 
 fn main() {
 }
index 6fae18dec10a67e602338a3f15de815a623b1589..5e3b777cc0b62cd845cb9af92176b3c64a590d8c 100644 (file)
@@ -15,7 +15,9 @@ enum S {
 fn bug(l: S) {
     match l {
         S::B{ } => { },
-        //~^ ERROR ambiguous associated type; specify the type using the syntax `<S as Trait>::B`
+        //~^ ERROR ambiguous associated type
+        //~| NOTE ambiguous associated type
+        //~| NOTE specify the type using the syntax `<S as Trait>::B`
     }
 }
 
index 5c661bfcdc0c99c99d0c248d40280b72246fc33c..e685ebc272098b1264366b8a59b0905305a4829e 100644 (file)
@@ -25,7 +25,11 @@ impl S {
     fn f<T>() {}
 }
 
-type A = <S as Tr>::A::f<u8>; //~ ERROR type parameters are not allowed on this type
-//~^ ERROR ambiguous associated type; specify the type using the syntax `<<S as Tr>::A as Trait>::f`
+type A = <S as Tr>::A::f<u8>;
+//~^ 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 `<<S as Tr>::A as Trait>::f`
 
 fn main() {}
index d058c6a5a3b93fbb6c6bf3f6d232d8e9fdc0806f..860e69fcaec4d46b6f0b43d12d17f4adc0ef8989 100644 (file)
@@ -31,9 +31,13 @@ impl SuperFoo for Bar {
 impl Bar {
     fn f() {
         let _: <Self>::Baz = true;
-//~^ERROR: ambiguous associated type; specify the type using the syntax `<Bar as Trait>::Baz`
+        //~^ ERROR ambiguous associated type
+        //~| NOTE ambiguous associated type
+        //~| NOTE specify the type using the syntax `<Bar as Trait>::Baz`
         let _: Self::Baz = true;
-//~^ERROR: ambiguous associated type; specify the type using the syntax `<Bar as Trait>::Baz`
+        //~^ ERROR ambiguous associated type
+        //~| NOTE ambiguous associated type
+        //~| NOTE specify the type using the syntax `<Bar as Trait>::Baz`
     }
 }