diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index b4e9fb5c65bb3..edf5fef2531da 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1285,6 +1285,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { "ambiguous associated type `{}` in bounds of `{}`", assoc_name, ty_param_name); + err.span_label(span, &format!("ambiguous associated type `{}`", assoc_name)); for bound in &bounds { span_note!(&mut err, span, diff --git a/src/test/compile-fail/E0221.rs b/src/test/compile-fail/E0221.rs index 213ec5a048880..651054580408d 100644 --- a/src/test/compile-fail/E0221.rs +++ b/src/test/compile-fail/E0221.rs @@ -18,7 +18,11 @@ trait Foo { trait Bar : Foo { type A: T2; fn do_something() { - let _: Self::A; //~ ERROR E0221 + let _: Self::A; + //~^ ERROR E0221 + //~| NOTE ambiguous associated type `A` + //~| NOTE associated type `Self` could derive from `Foo` + //~| NOTE associated type `Self` could derive from `Bar` } } diff --git a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs b/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs index 2b34fcab24c04..2f0a6acf26f26 100644 --- a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs @@ -27,22 +27,24 @@ pub trait BoxCar : Box + Vehicle { } fn dent(c: C, color: C::Color) { - //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE could derive from `Vehicle` - //~| NOTE could derive from `Box` + //~^ ERROR E0221 + //~| NOTE ambiguous associated type `Color` + //~| NOTE associated type `Color` could derive from `Vehicle` + //~| NOTE associated type `Color` could derive from `Box` } fn dent_object(c: BoxCar) { - //~^ ERROR ambiguous associated type - //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified - //~| NOTE could derive from `Vehicle` - //~| NOTE could derive from `Box` + //~^ ERROR E0221 + //~| NOTE ambiguous associated type `Color` + //~| NOTE associated type `Color` could derive from `Vehicle` + //~| NOTE associated type `Color` could derive from `Box` } fn paint(c: C, d: C::Color) { - //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE could derive from `Vehicle` - //~| NOTE could derive from `Box` + //~^ ERROR E0221 + //~| NOTE ambiguous associated type `Color` + //~| NOTE associated type `Color` could derive from `Vehicle` + //~| NOTE associated type `Color` could derive from `Box` } pub fn main() { }