3 // This code produces a CFG with critical edges that, if we don't
4 // handle properly, will cause invalid codegen.
6 #![feature(rustc_attrs)]
14 pub struct Foo<A: Iterator, B: Iterator> {
21 where A: Iterator, B: Iterator<Item=A::Item>
23 // This is the function we care about
24 fn next(&mut self) -> Option<A::Item> {
26 State::Both => match self.a.next() {
27 elt @ Some(..) => elt,
29 self.state = State::Back;
33 State::Front => self.a.next(),
34 State::Back => self.b.next(),
39 // Make sure we actually codegen a version of the function
40 pub fn do_stuff(mut f: Foo<Box<dyn Iterator<Item=u32>>, Box<dyn Iterator<Item=u32>>>) {