summaryrefslogtreecommitdiffstats
path: root/tests/ui/span/regionck-unboxed-closure-lifetimes.rs
blob: 60ccaa872e731715f376d9ef533b2c364226f034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(rustc_attrs)]
use std::ops::FnMut;

fn main() { #![rustc_error] // rust-lang/rust#49855
    let mut f;
    {
        let c = 1;
        let c_ref = &c;
        //~^ ERROR `c` does not live long enough
        f = move |a: isize, b: isize| { a + b + *c_ref };
    }
    f.use_mut();
}

trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
impl<T> Fake for T { }