rust/tests/ui/regions/regions-addr-of-upvar-self.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
356 B
Rust
Raw Normal View History

struct Dog {
food: usize,
}
impl Dog {
pub fn chase_cat(&mut self) {
let _f = || {
let p: &'static mut usize = &mut self.food;
2022-04-02 01:13:25 +08:00
//~^ ERROR lifetime may not live long enough
//~^^ ERROR lifetime may not live long enough
//~^^^ ERROR E0597
*p = 3;
};
}
}
fn main() {
}