Skip to content

Commit e8b0c30

Browse files
authored
Rollup merge of #123478 - maurer:cfi-call-once-addr-taken, r=compiler-errors
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. r? `@compiler-errors` cc `@rcvalle`
2 parents e01d3e0 + b53a0f2 commit e8b0c30

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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)