]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr
Auto merge of #42896 - llogiq:clippy_compiletest, r=alexcrichton
[rust.git] / src / test / ui / lifetime-errors / ex1-return-one-existing-name-self-is-anon.stderr
1 error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2   --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30
3    |
4 18 |         if true { x } else { self }
5    |                              ^^^^
6    |
7 note: ...the reference is valid for the lifetime 'a as defined on the method body at 16:5...
8   --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:16:5
9    |
10 16 | /     fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
11 17 | |
12 18 | |         if true { x } else { self }
13 19 | |
14 20 | |     }
15    | |_____^
16 note: ...but the borrowed content is only valid for the anonymous lifetime #1 defined on the method body at 16:5
17   --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:16:5
18    |
19 16 | /     fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
20 17 | |
21 18 | |         if true { x } else { self }
22 19 | |
23 20 | |     }
24    | |_____^
25
26 error: aborting due to previous error(s)
27