]> git.lizzy.rs Git - rust.git/blob - tests/ui/mir/simplify-branch-same.rs
Rollup merge of #103418 - Aaron1011:macro-semicolon-future-incompat, r=davidtwco
[rust.git] / tests / ui / mir / simplify-branch-same.rs
1 // Regression test for SimplifyBranchSame miscompilation.
2 // run-pass
3
4 macro_rules! m {
5     ($a:expr, $b:expr, $c:block) => {
6         match $a {
7             Lto::Fat | Lto::Thin => { $b; (); $c }
8             Lto::No => { $b; () }
9         }
10     }
11 }
12
13 pub enum Lto { No, Thin, Fat }
14
15 fn f(mut cookie: u32, lto: Lto) -> u32 {
16     let mut _a = false;
17     m!(lto, _a = true, {cookie = 0});
18     cookie
19 }
20
21 fn main() { assert_eq!(f(42, Lto::Thin), 0) }