]> git.lizzy.rs Git - rust.git/blob - tests/ui/inline-const/const-match-pat.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / inline-const / const-match-pat.rs
1 // run-pass
2
3 #![allow(incomplete_features)]
4 #![feature(inline_const_pat)]
5 const MMIO_BIT1: u8 = 4;
6 const MMIO_BIT2: u8 = 5;
7
8 fn main() {
9     let s = match read_mmio() {
10         0 => "FOO",
11         const { 1 << MMIO_BIT1 } => "BAR",
12         const { 1 << MMIO_BIT2 } => "BAZ",
13         _ => unreachable!(),
14     };
15
16     assert_eq!("BAZ", s);
17 }
18
19 fn read_mmio() -> i32 {
20     1 << 5
21 }