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