mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
19 lines
356 B
Rust
19 lines
356 B
Rust
struct Dog {
|
|
food: usize,
|
|
}
|
|
|
|
impl Dog {
|
|
pub fn chase_cat(&mut self) {
|
|
let _f = || {
|
|
let p: &'static mut usize = &mut self.food;
|
|
//~^ ERROR lifetime may not live long enough
|
|
//~^^ ERROR lifetime may not live long enough
|
|
//~^^^ ERROR E0597
|
|
*p = 3;
|
|
};
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
}
|