mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Rollup merge of #79631 - RalfJung:miri-const_str_ptr, r=oli-obk
disable a ptr equality test on Miri This test relies on deduplication of constants. I do not think that this is a *guarantee* that Rust currently makes, and indeed Miri does not deduplicate constants the same way that rustc does, leading to different behavior in this test. For now, I propose we simply disable this test in Miri.
This commit is contained in:
commit
0a52b43b24
@ -1978,9 +1978,14 @@ fn const_str_ptr() {
|
||||
const B: &'static [u8; 2] = &A;
|
||||
const C: *const u8 = B as *const u8;
|
||||
|
||||
unsafe {
|
||||
// Miri does not deduplicate consts (https://github.com/rust-lang/miri/issues/131)
|
||||
#[cfg(not(miri))]
|
||||
{
|
||||
let foo = &A as *const u8;
|
||||
assert_eq!(foo, C);
|
||||
}
|
||||
|
||||
unsafe {
|
||||
assert_eq!(from_utf8_unchecked(&A), "hi");
|
||||
assert_eq!(*C, A[0]);
|
||||
assert_eq!(*(&B[0] as *const u8), A[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user