Sign in
rust
/
rust
/
HEAD
/
.
/
tests
/
ui
/
closures
/
fnonce-call-twice-error.rs
blob: 1662b7bddaaee9c082becd66163d902240347235 [
file
] [
log
] [
blame
]
//! Test that `FnOnce` closures cannot be called twice.
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
);
});
}