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