]> git.lizzy.rs Git - rust.git/blob - src/test/ui/resolve/shadow-const-param.rs
Rollup merge of #87180 - notriddle:notriddle/sidebar-keyboard-mobile, r=GuillaumeGomez
[rust.git] / src / test / ui / resolve / shadow-const-param.rs
1 // Checks that const parameters cannot be shadowed with fresh bindings
2 // even in syntactically unambiguous contexts. See
3 // https://github.com/rust-lang/rust/issues/33118#issuecomment-233962221
4
5 fn foo<const N: i32>(i: i32) -> bool {
6     match i {
7         N @ _ => true,
8         //~^ ERROR: match bindings cannot shadow const parameters [E0530]
9     }
10 }
11
12 fn bar<const N: i32>(i: i32) -> bool {
13     let N @ _ = 0;
14     //~^ ERROR: let bindings cannot shadow const parameters [E0530]
15     match i {
16         N @ _ => true,
17     }
18 }
19
20 fn main() {}