Skip to content

Commit 776644c

Browse files
committed
Auto merge of #1712 - RalfJung:rustup, r=RalfJung
Rustup Fixes #1706 Cc #1711 for the temporarily disabled tests
2 parents b5b5df5 + 4c867fe commit 776644c

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bb587b1a1737738658d2eaecd4c8c1cab555257a
1+
42a4673fbd40b09a99d057eaa9b3e5579b54c184
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::mem::transmute;
2+
3+
#[cfg(target_pointer_width = "32")]
4+
type TwoPtrs = i64;
5+
#[cfg(target_pointer_width = "64")]
6+
type TwoPtrs = i128;
7+
8+
fn main() {
9+
for &my_bool in &[true, false] {
10+
let mask = -(my_bool as TwoPtrs); // false -> 0, true -> -1 aka !0
11+
// This is branchless code to select one or the other pointer.
12+
// For now, Miri brafs on it, but if this code ever passes we better make sure it behaves correctly.
13+
let val = unsafe {
14+
transmute::<_, &str>(
15+
!mask & transmute::<_, TwoPtrs>("false !") | mask & transmute::<_, TwoPtrs>("true !"), //~ERROR encountered (potentially part of) a pointer, but expected plain (non-pointer) bytes
16+
)
17+
};
18+
println!("{}", val);
19+
}
20+
}

tests/compile-fail/validity/execute_memory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ignore-test FIXME (Miri issue #1711)
12
#![feature(box_syntax)]
23

34
fn main() {

tests/compile-fail/validity/invalid_fnptr_uninit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ignore-test FIXME (Miri issue #1711)
12
#![allow(invalid_value)]
23

34
union MyUninit {

0 commit comments

Comments
 (0)