rust/tests/ui/closures/once-move-out-on-heap.rs
2023-01-11 09:32:08 +00:00

19 lines
238 B
Rust

// 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);
});
}