]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[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:17
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:17
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:19:18
25    |
26 LL |       pub fn chase_cat(&mut self) {
27    |                        - let's call the lifetime of this reference `'1`
28 LL |           let _f = || {
29    |  __________________^
30 LL | |             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
31 LL | |             *p = 3;
32 LL | |         };
33    | |_________^ closure body requires that `'1` must outlive `'static`
34
35 error[E0597]: `self` does not live long enough
36   --> $DIR/regions-addr-of-upvar-self.rs:20:46
37    |
38 LL |         let _f = || {
39    |                  -- value captured here
40 LL |             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
41    |                                              ^^^^ borrowed value does not live long enough
42 ...
43 LL |     }
44    |      - `self` dropped here while still borrowed
45    |
46    = note: borrowed value must be valid for the static lifetime...
47
48 error: aborting due to 4 previous errors
49
50 For more information about this error, try `rustc --explain E0597`.