]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/once-move-out-on-heap.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[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 }