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