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