summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-addr-of-upvar-self.rs
blob: 171eca32e296005fe21dfae1edb59ae662ff12d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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() {
}