2014-10-16 21:40:21 +02:00
|
|
|
trait NoLifetime {
|
|
|
|
|
fn get<'p, T : Test<'p>>(&self) -> T;
|
2018-01-28 13:42:49 -08:00
|
|
|
//~^ NOTE lifetimes in impl do not match this method in trait
|
2014-10-16 21:40:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trait Test<'p> {
|
|
|
|
|
fn new(buf: &'p mut [u8]) -> Self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Foo<'a> {
|
|
|
|
|
buf: &'a mut [u8],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<'a> Test<'a> for Foo<'a> {
|
|
|
|
|
fn new(buf: &'a mut [u8]) -> Foo<'a> {
|
|
|
|
|
Foo { buf: buf }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<'a> NoLifetime for Foo<'a> {
|
|
|
|
|
fn get<'p, T : Test<'a>>(&self) -> T {
|
2018-01-28 13:42:49 -08:00
|
|
|
//~^ ERROR E0195
|
|
|
|
|
//~| NOTE lifetimes do not match method in trait
|
2015-04-14 14:23:02 +02:00
|
|
|
return *self as T;
|
2014-10-16 21:40:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {}
|