2018-12-17 03:21:47 +00:00
|
|
|
struct Dog {
|
2015-01-08 11:02:42 +00:00
|
|
|
food: usize,
|
2012-09-08 02:04:40 +00:00
|
|
|
}
|
2012-05-19 17:31:48 +00:00
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
impl Dog {
|
2013-05-31 22:17:22 +00:00
|
|
|
pub fn chase_cat(&mut self) {
|
2015-02-01 17:44:15 +00:00
|
|
|
let _f = || {
|
2022-04-19 10:56:18 +00:00
|
|
|
let p: &'static mut usize = &mut self.food;
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
//~^^ ERROR lifetime may not live long enough
|
|
|
|
//~^^^ ERROR E0597
|
2015-03-03 08:42:26 +00:00
|
|
|
*p = 3;
|
2013-08-01 22:35:46 +00:00
|
|
|
};
|
2012-05-19 17:31:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-07-26 15:51:57 +00:00
|
|
|
}
|