]> git.lizzy.rs Git - rust.git/blob - tests/ui/resolve/shadow-const-param.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / 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() {}