Skip to content

Commit 142dc49

Browse files
Rollup merge of #35939 - creativcoder:e0195, r=jonathandturner
Update E0195 to new error format Fixes #35511 Part of #35233 r? @jonathandturner
2 parents ed4c0fd + 5ec6f39 commit 142dc49

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/librustc_typeck/check/compare_method.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,11 @@ pub fn compare_impl_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
469469
// are zero. Since I don't quite know how to phrase things at
470470
// the moment, give a kind of vague error message.
471471
if trait_params.len() != impl_params.len() {
472-
span_err!(ccx.tcx.sess, span, E0195,
472+
struct_span_err!(ccx.tcx.sess, span, E0195,
473473
"lifetime parameters or bounds on method `{}` do \
474-
not match the trait declaration",
475-
impl_m.name);
474+
not match the trait declaration",impl_m.name)
475+
.span_label(span, &format!("lifetimes do not match trait"))
476+
.emit();
476477
return false;
477478
}
478479

src/test/compile-fail/E0195.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct Foo;
1616

1717
impl Trait for Foo {
1818
fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195
19+
//~^ lifetimes do not match trait
1920
}
2021
}
2122

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

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ impl<'a> Test<'a> for Foo<'a> {
2929
impl<'a> NoLifetime for Foo<'a> {
3030
fn get<'p, T : Test<'a>>(&self) -> T {
3131
//~^ ERROR E0195
32+
//~| lifetimes do not match trait
3233
return *self as T;
3334
}
3435
}

0 commit comments

Comments
 (0)