-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1712 - RalfJung:rustup, r=RalfJung
- Loading branch information
Showing
4 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bb587b1a1737738658d2eaecd4c8c1cab555257a | ||
42a4673fbd40b09a99d057eaa9b3e5579b54c184 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use std::mem::transmute; | ||
fn main() { | ||
for &my_bool in &[true, false] { | ||
let mask = -(my_bool as i128); // 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::<_, i128>("false !") | mask & transmute::<_, i128>("true !"), //~ERROR encountered (potentially part of) a pointer, but expected plain (non-pointer) bytes | ||
) | ||
}; | ||
println!("{}", val); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// ignore-test FIXME (Miri issue #1711) | ||
#![feature(box_syntax)] | ||
|
||
fn main() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// ignore-test FIXME (Miri issue #1711) | ||
#![allow(invalid_value)] | ||
|
||
union MyUninit { | ||
|