]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-free-region-ordering-callee.stderr
add UI test + docs for `E0789`
[rust.git] / tests / ui / regions / regions-free-region-ordering-callee.stderr
1 error: lifetime may not live long enough
2   --> $DIR/regions-free-region-ordering-callee.rs:13:5
3    |
4 LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize {
5    |              --  -- lifetime `'b` defined here
6    |              |
7    |              lifetime `'a` defined here
8 LL |     // However, it is not safe to assume that 'b <= 'a
9 LL |     &*y
10    |     ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11    |
12    = help: consider adding the following bound: `'a: 'b`
13
14 error: lifetime may not live long enough
15   --> $DIR/regions-free-region-ordering-callee.rs:19:12
16    |
17 LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
18    |              --  -- lifetime `'b` defined here
19    |              |
20    |              lifetime `'a` defined here
21 LL |     // Do not infer an ordering from the return value.
22 LL |     let z: &'b usize = &*x;
23    |            ^^^^^^^^^ type annotation requires that `'a` must outlive `'b`
24    |
25    = help: consider adding the following bound: `'a: 'b`
26
27 error: aborting due to 2 previous errors
28