blob: ec676e69cf63218b5143b87b812caa97ae5b9524 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
warning: lifetime flowing from input to output with different syntax can be confusing
--> $DIR/self_lifetime.rs:7:23
|
LL | fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^^ --- the lifetime gets resolved as `'b`
| |
| this lifetime flows to the output
|
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: one option is to consistently use `'b`
|
LL | fn foo<'b>(self: &'b Foo<'a>) -> &'b () { self.0 }
| ++
warning: lifetime flowing from input to output with different syntax can be confusing
--> $DIR/self_lifetime.rs:13:36
|
LL | fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
| ^^ --- the lifetime gets resolved as `'a`
| |
| this lifetime flows to the output
|
help: one option is to consistently use `'a`
|
LL | fn bar<'a>(self: &Alias, arg: &'a ()) -> &'a () { arg }
| ++
warning: 2 warnings emitted
|