Skip to content

Commit b53a0f2

Browse files
committed
CFI: Add test for call_once addr taken
One of the proposed ways to reduce the non-passed argument erasure would cause this test to fail. Adding this now ensures that any attempt to reduce non-passed argument erasure won't make the same mistake.
1 parent a4b11c8 commit b53a0f2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: tests/ui/sanitizer/cfi-closures.rs

+11
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,14 @@ fn closure_addr_taken() {
7777
let call = Fn::<()>::call;
7878
use_closure(call, &f);
7979
}
80+
81+
fn use_closure_once<C>(call: extern "rust-call" fn(C, ()) -> i32, f: C) -> i32 {
82+
call(f, ())
83+
}
84+
85+
#[test]
86+
fn closure_once_addr_taken() {
87+
let g = || 3;
88+
let call2 = FnOnce::<()>::call_once;
89+
use_closure_once(call2, g);
90+
}

0 commit comments

Comments
 (0)