summaryrefslogtreecommitdiffstats
path: root/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs')
-rw-r--r--tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs
new file mode 100644
index 000000000..f1a3fb018
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs
@@ -0,0 +1,19 @@
+use std::pin::Pin;
+
+struct Foo;
+
+impl Foo {
+ fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
+ //~^ lifetime may not live long enough
+
+ 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 {
+ fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
+ //~^ lifetime may not live long enough
+}
+
+fn main() {}