]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/once-move-out-on-heap.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / once-move-out-on-heap.rs
CommitLineData
970d7e83
LB
1// Testing guarantees provided by once functions.
2
970d7e83 3
c34b1796 4
1a4d82fc 5use std::sync::Arc;
970d7e83 6
1a4d82fc 7fn foo<F:FnOnce()>(blk: F) {
970d7e83
LB
8 blk();
9}
223e47cc 10
1a4d82fc
JJ
11pub fn main() {
12 let x = Arc::new(true);
13 foo(move|| {
14 assert!(*x);
15 drop(x);
16 });
223e47cc 17}