Auto merge of #1712 - RalfJung:rustup, r=RalfJung

Rustup

Fixes https://github.com/rust-lang/miri/issues/1706
Cc https://github.com/rust-lang/miri/issues/1711 for the temporarily disabled tests
This commit is contained in:
bors 2021-02-16 09:18:57 +00:00
commit 776644c85f
4 changed files with 23 additions and 1 deletions

View File

@ -1 +1 @@
bb587b1a1737738658d2eaecd4c8c1cab555257a
42a4673fbd40b09a99d057eaa9b3e5579b54c184

View File

@ -0,0 +1,20 @@
use std::mem::transmute;
#[cfg(target_pointer_width = "32")]
type TwoPtrs = i64;
#[cfg(target_pointer_width = "64")]
type TwoPtrs = i128;
fn main() {
for &my_bool in &[true, false] {
let mask = -(my_bool as TwoPtrs); // false -> 0, true -> -1 aka !0
// This is branchless code to select one or the other pointer.
// For now, Miri brafs on it, but if this code ever passes we better make sure it behaves correctly.
let val = unsafe {
transmute::<_, &str>(
!mask & transmute::<_, TwoPtrs>("false !") | mask & transmute::<_, TwoPtrs>("true !"), //~ERROR encountered (potentially part of) a pointer, but expected plain (non-pointer) bytes
)
};
println!("{}", val);
}
}

View File

@ -1,3 +1,4 @@
// ignore-test FIXME (Miri issue #1711)
#![feature(box_syntax)]
fn main() {

View File

@ -1,3 +1,4 @@
// ignore-test FIXME (Miri issue #1711)
#![allow(invalid_value)]
union MyUninit {