]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/generator_tiny.rs
Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk
[rust.git] / tests / mir-opt / generator_tiny.rs
1 //! Tests that generators that cannot return or unwind don't have unnecessary
2 //! panic branches.
3
4 // compile-flags: -C panic=abort
5 // no-prefer-dynamic
6
7 #![feature(generators, generator_trait)]
8
9 struct HasDrop;
10
11 impl Drop for HasDrop {
12     fn drop(&mut self) {}
13 }
14
15 fn callee() {}
16
17 // EMIT_MIR generator_tiny.main-{closure#0}.generator_resume.0.mir
18 fn main() {
19     let _gen = |_x: u8| {
20         let _d = HasDrop;
21         loop {
22             yield;
23             callee();
24         }
25     };
26 }