Skip to content

Commit 9ffd086

Browse files
committed
review comment: add test case
1 parent e802165 commit 9ffd086

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ where
2525
}
2626
}
2727

28+
trait Bar {
29+
fn foo<'a>(&'a self) {}
30+
}
31+
32+
impl Bar for () {
33+
fn foo<'a: 'a>(&'a self) {} //~ ERROR E0195
34+
}
35+
2836
fn main() {
2937
().foo((), ());
3038
}

src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ LL | T: 'a;
2222
LL | fn foo<'a>(&self, state: &'a State) -> &'a T {
2323
| ^^^^ lifetimes do not match method in trait
2424

25-
error: aborting due to 2 previous errors
25+
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
26+
--> $DIR/impl-missing-where-clause-lifetimes-from-trait.rs:33:11
27+
|
28+
LL | fn foo<'a>(&'a self) {}
29+
| ---- lifetimes in impl do not match this method in trait
30+
...
31+
LL | fn foo<'a: 'a>(&'a self) {}
32+
| ^^^^^^^^ lifetimes do not match method in trait
33+
34+
error: aborting due to 3 previous errors
2635

2736
For more information about this error, try `rustc --explain E0195`.

0 commit comments

Comments
 (0)