]>
Commit | Line | Data |
---|---|---|
970d7e83 LB |
1 | // Testing guarantees provided by once functions. |
2 | ||
970d7e83 | 3 | |
c34b1796 | 4 | |
1a4d82fc | 5 | use std::sync::Arc; |
970d7e83 | 6 | |
1a4d82fc | 7 | fn foo<F:FnOnce()>(blk: F) { |
970d7e83 LB |
8 | blk(); |
9 | } | |
223e47cc | 10 | |
1a4d82fc JJ |
11 | pub fn main() { |
12 | let x = Arc::new(true); | |
13 | foo(move|| { | |
14 | assert!(*x); | |
15 | drop(x); | |
16 | }); | |
223e47cc | 17 | } |