Skip to content

Commit 791fb77

Browse files
authored
Auto merge of #36862 - chamoysvoice:E0220, r=GuillaumeGomez
Update E0220 error format @jonathandturner Part of #35233 . Fixes #35385.
2 parents fe36876 + f4fdf81 commit 791fb77

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/librustc_typeck/astconv.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1241,10 +1241,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
12411241
-> Result<ty::PolyTraitRef<'tcx>, ErrorReported>
12421242
{
12431243
if bounds.is_empty() {
1244-
span_err!(self.tcx().sess, span, E0220,
1244+
struct_span_err!(self.tcx().sess, span, E0220,
12451245
"associated type `{}` not found for `{}`",
12461246
assoc_name,
1247-
ty_param_name);
1247+
ty_param_name)
1248+
.span_label(span, &format!("associated type `{}` not found", assoc_name))
1249+
.emit();
12481250
return Err(ErrorReported);
12491251
}
12501252

src/test/compile-fail/E0220.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ trait Trait {
1313
}
1414

1515
type Foo = Trait<F=i32>; //~ ERROR E0220
16-
//~^ ERROR E0191
17-
16+
//~| NOTE associated type `F` not found
17+
//~| ERROR E0191
18+
//~| NOTE missing associated type `Bar` value
1819
fn main() {
1920
}

src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ trait Trait {}
1515
fn f<F:Trait(isize) -> isize>(x: F) {}
1616
//~^ ERROR E0244
1717
//~| NOTE expected no type arguments, found 1
18-
//~| ERROR associated type `Output` not found
18+
//~| ERROR E0220
19+
//~| NOTE associated type `Output` not found
1920

2021
fn main() {}

src/test/ui/span/type-binding.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0220]: associated type `Trget` not found for `std::ops::Deref`
22
--> $DIR/type-binding.rs:16:20
33
|
44
16 | fn homura<T: Deref<Trget = i32>>(_: T) {}
5-
| ^^^^^^^^^^^
5+
| ^^^^^^^^^^^ associated type `Trget` not found
66

77
error: aborting due to previous error
88

0 commit comments

Comments
 (0)