blob: 3fd8c5cadca98c80db915fecde5cb2df4d2f979a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// Testing guarantees provided by once functions.
// This program would segfault if it were legal.
use std::sync::Arc;
fn foo<F:FnOnce()>(blk: F) {
blk();
blk(); //~ ERROR use of moved value
}
fn main() {
let x = Arc::new(true);
foo(move|| {
assert!(*x);
drop(x);
});
}
|