Skip to content

Commit

Permalink
Unrolled build for rust-lang#123478
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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`
  • Loading branch information
rust-timer committed Apr 5, 2024
2 parents 9cbaa01 + b53a0f2 commit 9616bf6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ui/sanitizer/cfi-closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,14 @@ fn closure_addr_taken() {
let call = Fn::<()>::call;
use_closure(call, &f);
}

fn use_closure_once<C>(call: extern "rust-call" fn(C, ()) -> i32, f: C) -> i32 {
call(f, ())
}

#[test]
fn closure_once_addr_taken() {
let g = || 3;
let call2 = FnOnce::<()>::call_once;
use_closure_once(call2, g);
}

0 comments on commit 9616bf6

Please sign in to comment.