]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/once-move-out-on-heap.rs
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
[rust.git] / tests / ui / closures / once-move-out-on-heap.rs
1 // run-pass
2 // Testing guarantees provided by once functions.
3
4
5
6 use std::sync::Arc;
7
8 fn foo<F:FnOnce()>(blk: F) {
9     blk();
10 }
11
12 pub fn main() {
13     let x = Arc::new(true);
14     foo(move|| {
15         assert!(*x);
16         drop(x);
17     });
18 }