summaryrefslogtreecommitdiffstats
path: root/src/test/ui/span/issue-11925.rs
blob: d9c08fbdd0f15e2521ad5967f3b3a9abbd9c77b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#![feature(unboxed_closures)]

fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }

fn main() {
    let r = {
        let x: Box<_> = Box::new(42);
        let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x`
        f()
    };

    drop(r);
}