]> git.proxmox.com Git - rustc.git/blob - src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / self / arbitrary_self_types_pin_lifetime_mismatch.rs
1 // revisions: base nll
2 // ignore-compare-mode-nll
3 //[nll] compile-flags: -Z borrowck=mir
4
5 use std::pin::Pin;
6
7 struct Foo;
8
9 impl Foo {
10 fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
11 //[base]~^ ERROR E0623
12 //[nll]~^^ lifetime may not live long enough
13
14 fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
15 //[base]~^ ERROR E0623
16 //[nll]~^^ lifetime may not live long enough
17 }
18
19 type Alias<T> = Pin<T>;
20 impl Foo {
21 fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
22 //[base]~^ ERROR E0623
23 //[nll]~^^ lifetime may not live long enough
24 }
25
26 fn main() {}