File tree 2 files changed +5
-34
lines changed
2 files changed +5
-34
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,12 @@ fn f<T: FnOnce()>(t: T) {
13
13
fn main ( ) {
14
14
let mut ran_drop = false ;
15
15
{
16
- // FIXME: v is a temporary hack to force the below closure to be a FnOnce-only closure
17
- // (with sig fn(self)). Without it, the closure sig would be fn(&self) which requires a
18
- // shim to call via FnOnce::call_once, and Miri's current shim doesn't correctly call
19
- // destructors.
20
- let v = vec ! [ 1 ] ;
21
16
let x = Foo ( & mut ran_drop) ;
22
- let g = move || {
23
- let _ = x ;
24
- drop ( v ) ; // Force the closure to be FnOnce-only by using a capture by-value.
25
- } ;
26
- f ( g ) ;
17
+ // this closure never by val uses its captures
18
+ // so it's basically a fn(&self)
19
+ // the shim used to not drop the `x`
20
+ let x = move || { let _ = x ; } ;
21
+ f ( x ) ;
27
22
}
28
23
assert ! ( ran_drop) ;
29
24
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments