]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0490.nll.stderr
Merge commit 'd556c56f792756dd7cfec742b9f2e07612dc10f4' into sync_cg_clif-2021-02-01
[rust.git] / src / test / ui / error-codes / E0490.nll.stderr
1 error: lifetime may not live long enough
2   --> $DIR/E0490.rs:2:12
3    |
4 LL | fn f<'a, 'b>(y: &'b ()) {
5    |      --  -- lifetime `'b` defined here
6    |      |
7    |      lifetime `'a` defined here
8 LL |     let x: &'a _ = &y;
9    |            ^^^^^ type annotation requires that `'b` must outlive `'a`
10    |
11    = help: consider adding the following bound: `'b: 'a`
12
13 error[E0597]: `y` does not live long enough
14   --> $DIR/E0490.rs:2:20
15    |
16 LL | fn f<'a, 'b>(y: &'b ()) {
17    |      -- lifetime `'a` defined here
18 LL |     let x: &'a _ = &y;
19    |            -----   ^^ borrowed value does not live long enough
20    |            |
21    |            type annotation requires that `y` is borrowed for `'a`
22 ...
23 LL | }
24    |  - `y` dropped here while still borrowed
25
26 error: aborting due to 2 previous errors
27
28 For more information about this error, try `rustc --explain E0597`.