]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
Change NLL compare mode to borrowck=migrate.
[rust.git] / src / test / ui / regions / regions-addr-of-upvar-self.nll.stderr
1 error: unsatisfied lifetime constraints
2   --> $DIR/regions-addr-of-upvar-self.rs:20:20
3    |
4 LL |         let _f = || {
5    |                  -- lifetime `'1` represents this closure's body
6 LL |             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
7    |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
8    |
9    = note: closure implements `FnMut`, so references to captured variables can't escape the closure
10
11 error: unsatisfied lifetime constraints
12   --> $DIR/regions-addr-of-upvar-self.rs:20:20
13    |
14 LL |     pub fn chase_cat(&mut self) {
15    |                      --------- lifetime `'2` appears in the type of `self`
16 LL |         let _f = || {
17    |                  -- lifetime `'1` represents this closure's body
18 LL |             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
19    |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'2`
20    |
21    = note: closure implements `FnMut`, so references to captured variables can't escape the closure
22
23 error: unsatisfied lifetime constraints
24   --> $DIR/regions-addr-of-upvar-self.rs:20:20
25    |
26 LL |     pub fn chase_cat(&mut self) {
27    |                      - let's call the lifetime of this reference `'1`
28 LL |         let _f = || {
29 LL |             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
30    |                    ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
31
32 error[E0597]: `self` does not live long enough
33   --> $DIR/regions-addr-of-upvar-self.rs:20:46
34    |
35 LL |         let _f = || {
36    |                  -- value captured here
37 LL |             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
38    |                                              ^^^^ borrowed value does not live long enough
39 ...
40 LL |     }
41    |      - `self` dropped here while still borrowed
42    |
43    = note: borrowed value must be valid for the static lifetime...
44
45 error: aborting due to 4 previous errors
46
47 For more information about this error, try `rustc --explain E0597`.