Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable a ptr equality test on Miri #79631

Merged
merged 2 commits into from
Dec 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion library/alloc/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to have the comment and the attribute on the same line (so that grepping for the attribute also shows explanations) but rustfmt won't let me. :(

{
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]);
Expand Down