mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Add test.
This commit is contained in:
parent
9aa232ecc7
commit
7ec9601a0b
25
tests/mir-opt/issue_120925_unsafefncast.rs
Normal file
25
tests/mir-opt/issue_120925_unsafefncast.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// Verify that we do not ICE when attempting to interpret casts between fn types.
|
||||
// skip-filecheck
|
||||
|
||||
static FOO: fn() = || assert_ne!(42, 43);
|
||||
static BAR: fn(i32, i32) = |a, b| assert_ne!(a, b);
|
||||
|
||||
fn main() {
|
||||
FOO();
|
||||
|
||||
let bar: unsafe fn(i32, i32) = BAR;
|
||||
|
||||
let f: fn() = || {};
|
||||
f();
|
||||
|
||||
f();
|
||||
|
||||
f();
|
||||
|
||||
let g: fn(i32) = |i| assert_eq!(i, 2);
|
||||
g(2);
|
||||
|
||||
g(2);
|
||||
|
||||
g(2);
|
||||
}
|
Loading…
Reference in New Issue
Block a user