Skip to content

Commit

Permalink
review comment: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Dec 6, 2022
1 parent e802165 commit 9ffd086
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ where
}
}

trait Bar {
fn foo<'a>(&'a self) {}
}

impl Bar for () {
fn foo<'a: 'a>(&'a self) {} //~ ERROR E0195
}

fn main() {
().foo((), ());
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ LL | T: 'a;
LL | fn foo<'a>(&self, state: &'a State) -> &'a T {
| ^^^^ lifetimes do not match method in trait

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

error: aborting due to 3 previous errors

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

0 comments on commit 9ffd086

Please sign in to comment.