-
Notifications
You must be signed in to change notification settings - Fork 385
New test for loading a pointer as part of a read #1706
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
Comments
Yeah sure, we can add that. For the error message, I guess it's the other way around here -- encountered pointer in part of a read. ;) Not sure how to best word it though. |
But also, I wouldn't mind an explanation of what the point of this is.^^ |
Most of the code in this test is actually irrelevant; |
Really sorry about the confusion!
The weird It makes a bit more sense in context, where |
This version might look less obfuscated, and is probably a better fit for a test (originally it was just a Discord one-liner): use std::mem::transmute;
fn main() {
for &my_bool in &[true, false] {
let mask = -(my_bool as i128); // false -> 0, true -> -1 aka !0
unsafe {
println!(
"{}",
transmute::<_, &str>(
!mask & transmute::<_, i128>("false !") | mask & transmute::<_, i128>("true !")
)
);
}
}
} |
I see. However, given that the That said, I hope that Miri will support that kind of |
@eddyb would like
to be in the miri test suite.
The diagnostic is also wrong, it's actually that we want to put two pointers into a single
i128
immediate value.The text was updated successfully, but these errors were encountered: