]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-addr-of-self.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / regions / regions-addr-of-self.stderr
1 error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
2   --> $DIR/regions-addr-of-self.rs:7:37
3    |
4 LL |         let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
5    |                                     ^^^^^^^^^^^^^^^^^^^^^
6    |
7 note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 6:5...
8   --> $DIR/regions-addr-of-self.rs:6:5
9    |
10 LL | /     pub fn chase_cat(&mut self) {
11 LL | |         let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
12 LL | |         *p += 1;
13 LL | |     }
14    | |_____^
15 note: ...so that reference does not outlive borrowed content
16   --> $DIR/regions-addr-of-self.rs:7:37
17    |
18 LL |         let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
19    |                                     ^^^^^^^^^^^^^^^^^^^^^
20    = note: but, the lifetime must be valid for the static lifetime...
21 note: ...so that reference does not outlive borrowed content
22   --> $DIR/regions-addr-of-self.rs:7:37
23    |
24 LL |         let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
25    |                                     ^^^^^^^^^^^^^^^^^^^^^
26
27 error: aborting due to previous error
28
29 For more information about this error, try `rustc --explain E0495`.