mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
Auto merge of #1552 - RalfJung:rustup, r=RalfJung
rustup; make sure the generator moves even with smarter optimizations
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
7bdb5dee7bac15458b10b148e9e24968e633053e
|
||||
a3bc0e752fad96f537b73f4e9bc805a73d404f7b
|
||||
|
||||
@@ -34,10 +34,10 @@ fn next(&mut self) -> Option<Self::Item> {
|
||||
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user