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

rustup; make sure the generator moves even with smarter optimizations
This commit is contained in:
bors 2020-09-20 10:18:29 +00:00
commit 7942e7797b
4 changed files with 8 additions and 6 deletions

View File

@ -1 +1 @@
7bdb5dee7bac15458b10b148e9e24968e633053e
a3bc0e752fad96f537b73f4e9bc805a73d404f7b

View File

@ -34,10 +34,10 @@ where
fn main() {
let mut generator_iterator_2 = {
let mut generator_iterator = GeneratorIteratorAdapter(firstn());
let mut generator_iterator = Box::new(GeneratorIteratorAdapter(firstn()));
generator_iterator.next(); // pin it
generator_iterator // move it
Box::new(*generator_iterator) // move it
}; // *deallocate* generator_iterator
generator_iterator_2.next(); // and use moved value

View File

@ -1,5 +1,5 @@
// This should fail even without validation
// compile-flags: -Zmiri-disable-validation
// This should fail even without validation, but some MIR opts mask the error
// compile-flags: -Zmiri-disable-validation -Zmir-opt-level=0
static mut LEAK: usize = 0;

View File

@ -1,4 +1,5 @@
#[repr(u32)]
#[derive(Debug)]
enum Bool { True }
fn evil(x: &mut Bool) {
@ -9,6 +10,7 @@ fn evil(x: &mut Bool) {
fn main() {
let mut x = Bool::True;
evil(&mut x);
let _y = x; // reading this ought to be enough to trigger validation
let y = x; // reading this ought to be enough to trigger validation
//~^ ERROR encountered 0x0000002c at .<enum-tag>, but expected a valid enum tag
println!("{:?}", y); // make sure it is used (and not optimized away)
}