summaryrefslogtreecommitdiffstats
path: root/tests/ui/unboxed-closures/unboxed-closure-region.rs
blob: 51fe118c93ff146c6f67d8da2cdf9437f1d21daa (plain)
1
2
3
4
5
6
7
8
9
10
11
// Test that an unboxed closure that captures a free variable by
// reference cannot escape the region of that variable.


fn main() {
    let _f = {
        let x = 0;
        || x //~ ERROR closure may outlive the current block, but it borrows `x`
    };
    _f;
}