Skip to content

Commit 065c685

Browse files
committed
Update E0223 to the new format
1 parent b30eff7 commit 065c685

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

src/librustc_typeck/astconv.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1211,10 +1211,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
12111211
type_str: &str,
12121212
trait_str: &str,
12131213
name: &str) {
1214-
span_err!(self.tcx().sess, span, E0223,
1215-
"ambiguous associated type; specify the type using the syntax \
1216-
`<{} as {}>::{}`",
1217-
type_str, trait_str, name);
1214+
struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type")
1215+
.span_label(span, &format!("ambiguous associated type"))
1216+
.note(&format!("specify the type using the syntax `<{} as {}>::{}`",
1217+
type_str, trait_str, name))
1218+
.emit();
1219+
12181220
}
12191221

12201222
// Search for a bound on a type parameter which includes the associated item

src/test/compile-fail/E0223.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
trait MyTrait { type X; }
1212

1313
fn main() {
14-
let foo: MyTrait::X; //~ ERROR E0223
14+
let foo: MyTrait::X;
15+
//~^ ERROR ambiguous associated type
16+
//~| NOTE ambiguous associated type
17+
//~| NOTE specify the type using the syntax `<Type as MyTrait>::X`
1518
}

src/test/compile-fail/associated-types-in-ambiguous-context.rs

+6
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ trait Get {
1515

1616
fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
1717
//~^ ERROR ambiguous associated type
18+
//~| NOTE ambiguous associated type
19+
//~| NOTE specify the type using the syntax `<Type as Get>::Value`
1820

1921
trait Grab {
2022
type Value;
2123
fn grab(&self) -> Grab::Value;
2224
//~^ ERROR ambiguous associated type
25+
//~| NOTE ambiguous associated type
26+
//~| NOTE specify the type using the syntax `<Type as Grab>::Value`
2327
}
2428

2529
type X = std::ops::Deref::Target;
2630
//~^ ERROR ambiguous associated type
31+
//~| NOTE ambiguous associated type
32+
//~| NOTE specify the type using the syntax `<Type as std::ops::Deref>::Target`
2733

2834
fn main() {
2935
}

src/test/compile-fail/issue-34209.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ enum S {
1515
fn bug(l: S) {
1616
match l {
1717
S::B{ } => { },
18-
//~^ ERROR ambiguous associated type; specify the type using the syntax `<S as Trait>::B`
18+
//~^ ERROR ambiguous associated type
19+
//~| NOTE ambiguous associated type
20+
//~| NOTE specify the type using the syntax `<S as Trait>::B`
1921
}
2022
}
2123

src/test/compile-fail/qualified-path-params-2.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ impl S {
2525
fn f<T>() {}
2626
}
2727

28-
type A = <S as Tr>::A::f<u8>; //~ ERROR type parameters are not allowed on this type
29-
//~^ ERROR ambiguous associated type; specify the type using the syntax `<<S as Tr>::A as Trait>::f`
28+
type A = <S as Tr>::A::f<u8>;
29+
//~^ ERROR type parameters are not allowed on this type
30+
//~| NOTE type parameter not allowed
31+
//~| ERROR ambiguous associated type
32+
//~| NOTE ambiguous associated type
33+
//~| NOTE specify the type using the syntax `<<S as Tr>::A as Trait>::f`
3034

3135
fn main() {}

src/test/compile-fail/self-impl.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ impl SuperFoo for Bar {
3131
impl Bar {
3232
fn f() {
3333
let _: <Self>::Baz = true;
34-
//~^ERROR: ambiguous associated type; specify the type using the syntax `<Bar as Trait>::Baz`
34+
//~^ ERROR ambiguous associated type
35+
//~| NOTE ambiguous associated type
36+
//~| NOTE specify the type using the syntax `<Bar as Trait>::Baz`
3537
let _: Self::Baz = true;
36-
//~^ERROR: ambiguous associated type; specify the type using the syntax `<Bar as Trait>::Baz`
38+
//~^ ERROR ambiguous associated type
39+
//~| NOTE ambiguous associated type
40+
//~| NOTE specify the type using the syntax `<Bar as Trait>::Baz`
3741
}
3842
}
3943

0 commit comments

Comments
 (0)