summaryrefslogtreecommitdiffstats
path: root/src/test/ui/closures/once-move-out-on-heap.rs
blob: 4e2e400cec02371e3918f73e9d198c55cab66d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-pass
// Testing guarantees provided by once functions.



use std::sync::Arc;

fn foo<F:FnOnce()>(blk: F) {
    blk();
}

pub fn main() {
    let x = Arc::new(true);
    foo(move|| {
        assert!(*x);
        drop(x);
    });
}