Skip to content

Commit 29c53a8

Browse files
Rollup merge of rust-lang#36056 - birryree:E0194_new_error_format, r=jonathandturner
Update E0194 to new error format Fixes rust-lang#35280 to update E0194 to support new error message format. Part of rust-lang#35233. A separate Github issue rust-lang#36057 tracks the bonus portion of the original ticket. r? @jonathandturner
2 parents 9c758f3 + eea03f5 commit 29c53a8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/librustc_typeck/check/wfcheck.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ fn error_392<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, span: Span, param_name: ast::N
631631
}
632632

633633
fn error_194(tcx: TyCtxt, span: Span, name: ast::Name) {
634-
span_err!(tcx.sess, span, E0194,
634+
struct_span_err!(tcx.sess, span, E0194,
635635
"type parameter `{}` shadows another type parameter of the same name",
636-
name);
636+
name)
637+
.span_label(span, &format!("`{}` shadows another type parameter", name))
638+
.emit();
637639
}

src/test/compile-fail/E0194.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
trait Foo<T> {
1212
fn do_something(&self) -> T;
13-
fn do_something_else<T: Clone>(&self, bar: T); //~ ERROR E0194
13+
fn do_something_else<T: Clone>(&self, bar: T);
14+
//~^ ERROR E0194
15+
//~| NOTE `T` shadows another type parameter
1416
}
1517

1618
fn main() {

0 commit comments

Comments
 (0)