diff options
Diffstat (limited to 'src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs')
-rw-r--r-- | src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs new file mode 100644 index 000000000..a2b7f0805 --- /dev/null +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs @@ -0,0 +1,21 @@ +// edition:2018 + +use std::pin::Pin; + +struct Foo; + +impl Foo { + async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } + //~^ lifetime may not live long enough + + async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } + //~^ lifetime may not live long enough +} + +type Alias<T> = Pin<T>; +impl Foo { + async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } + //~^ lifetime may not live long enough +} + +fn main() {} |