Skip to content

Commit 31c81ac

Browse files
committed
Merge move_fn_closure run-passtest into closure-drop
1 parent 38d16cc commit 31c81ac

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

tests/run-pass/closure-drop.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@ fn f<T: FnOnce()>(t: T) {
1313
fn main() {
1414
let mut ran_drop = false;
1515
{
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];
2116
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);
2722
}
2823
assert!(ran_drop);
2924
}

tests/run-pass/move_fn_closure.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)