]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / test / ui / lifetimes / lifetime-errors / ex1-return-one-existing-name-if-else-using-impl.nll.stderr
1 error: lifetime may not live long enough
2   --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20
3    |
4 LL |     fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
5    |            --     - let's call the lifetime of this reference `'1`
6    |            |
7    |            lifetime `'a` defined here
8 LL | 
9 LL |         if x > y { x } else { y }
10    |                    ^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
11
12 error: aborting due to previous error
13