]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/non-constant-in-const-path.rs
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
[rust.git] / src / test / ui / pattern / non-constant-in-const-path.rs
1 // Checks if we emit `PatternError`s correctly.
2 // This is also a regression test for #27895 and #68394.
3
4 static FOO: u8 = 10;
5
6 fn main() {
7     let x = 0;
8     let 0u8..=x = 0;
9     //~^ ERROR: runtime values cannot be referenced in patterns
10     let 0u8..=FOO = 0;
11     //~^ ERROR: statics cannot be referenced in patterns
12     match 1 {
13         0 ..= x => {}
14         //~^ ERROR: runtime values cannot be referenced in patterns
15         0 ..= FOO => {}
16         //~^ ERROR: statics cannot be referenced in patterns
17     };
18 }