2 // Regression test for incorrect DropAndReplace behavior introduced in #60840
3 // and fixed in #61373. When combined with the optimization implemented in
4 // #60187, this produced incorrect code for generators when a saved local was
7 #![feature(generators, generator_trait)]
9 use std::ops::{Generator, GeneratorState};
12 #[derive(Debug, PartialEq)]
16 fn drop(&mut self) { }
25 // At one point this tricked our dataflow analysis into thinking `x` was
26 // StorageDead after the assignment.
40 match Pin::new(&mut a).resume(()) {
41 GeneratorState::Complete(()) => break,