Skip to content

Commit ea2ecd4

Browse files
committed
Do not merge fn pointer casts.
1 parent 9560da0 commit ea2ecd4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/pass/function_pointers.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ fn main() {
8080
// but Miri currently uses a fixed address for monomorphic functions.
8181
assert!(return_fn_ptr(i) == i);
8282
assert!(return_fn_ptr(i) as unsafe fn() -> i32 == i as fn() -> i32 as unsafe fn() -> i32);
83-
// We don't check anything for `f`. Miri gives it many different addresses
84-
// but mir-opts can turn them into the same address.
85-
let _val = return_fn_ptr(f) != f;
83+
// Miri gives it many different addresses to different reifications of a generic function.
84+
assert!(return_fn_ptr(f) != f);
8685
// However, if we only turn `f` into a function pointer and use that pointer,
8786
// it is equal to itself.
8887
let f2 = f as fn() -> i32;

0 commit comments

Comments
 (0)