mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-18 17:34:40 -04:00
review comment: add test case
This commit is contained in:
@@ -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((), ());
|
||||
}
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user