Skip to content

Commit 7db3f86

Browse files
author
Jonathan Turner
authored
Rollup merge of #35507 - hank-der-hafenarbeiter:master, r=jonathandturner
Updated Error mesage to new format for E0221 Part of #35386 r? @jonathandturner
2 parents 0a3766a + 6eb0218 commit 7db3f86

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/librustc_typeck/astconv.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1287,10 +1287,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
12871287
}
12881288

12891289
if bounds.len() > 1 {
1290-
let mut err = struct_span_err!(self.tcx().sess, span, E0221,
1291-
"ambiguous associated type `{}` in bounds of `{}`",
1292-
assoc_name,
1293-
ty_param_name);
1290+
let mut err = struct_span_err!(
1291+
self.tcx().sess, span, E0221,
1292+
"ambiguous associated type `{}` in bounds of `{}`",
1293+
assoc_name,
1294+
ty_param_name);
1295+
err.span_label(span, &format!("ambiguous associated type `{}`", assoc_name));
12941296

12951297
for bound in &bounds {
12961298
span_note!(&mut err, span,

src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs

+3
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@ pub trait BoxCar : Box + Vehicle {
2828

2929
fn dent<C:BoxCar>(c: C, color: C::Color) {
3030
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
31+
//~| NOTE ambiguous associated type `Color`
3132
//~| NOTE could derive from `Vehicle`
3233
//~| NOTE could derive from `Box`
3334
}
3435

3536
fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
3637
//~^ ERROR ambiguous associated type
3738
//~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified
39+
//~| NOTE ambiguous associated type `Color`
3840
//~| NOTE could derive from `Vehicle`
3941
//~| NOTE could derive from `Box`
4042
//~| NOTE missing associated type `Color` value
4143
}
4244

4345
fn paint<C:BoxCar>(c: C, d: C::Color) {
4446
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
47+
//~| NOTE ambiguous associated type `Color`
4548
//~| NOTE could derive from `Vehicle`
4649
//~| NOTE could derive from `Box`
4750
}

0 commit comments

Comments
 (0)