]> git.lizzy.rs Git - rust.git/blob - tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr
Rollup merge of #107091 - clubby789:infer-ftl-missing-dollar, r=compiler-errors
[rust.git] / tests / ui / self / arbitrary_self_types_pin_lifetime_mismatch.stderr
1 error: lifetime may not live long enough
2   --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:6:46
3    |
4 LL |     fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
5    |                    -         -               ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
6    |                    |         |
7    |                    |         let's call the lifetime of this reference `'1`
8    |                    let's call the lifetime of this reference `'2`
9    |
10 help: consider introducing a named lifetime parameter and update trait if needed
11    |
12 LL |     fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f }
13    |         ++++            ++           ++
14
15 error: lifetime may not live long enough
16   --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:9:69
17    |
18 LL |     fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
19    |                    -          -                                     ^^^^^^^^^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
20    |                    |          |
21    |                    |          let's call the lifetime of this reference `'1`
22    |                    let's call the lifetime of this reference `'2`
23    |
24 help: consider introducing a named lifetime parameter and update trait if needed
25    |
26 LL |     fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
27    |         ++++            ++            ++
28
29 error: lifetime may not live long enough
30   --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:15:58
31    |
32 LL |     fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
33    |            --  ---- has type `Pin<&'1 Foo>`              ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
34    |            |
35    |            lifetime `'a` defined here
36
37 error: aborting due to 3 previous errors
38