1 // run-pass 2 // Testing guarantees provided by once functions. 3 4 5 6 use std::sync::Arc; 7 foo<F:FnOnce()>(blk: F)8 fn foo<F:FnOnce()>(blk: F) { 9 blk(); 10 } 11 main()12 pub fn main() { 13 let x = Arc::new(true); 14 foo(move|| { 15 assert!(*x); 16 drop(x); 17 }); 18 } 19