about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-05-26 13:32:05 +0200
committerGitHub <noreply@github.com>2021-05-26 13:32:05 +0200
commit69c78a98ee2fb1e96675beb50115495bffca9777 (patch)
treeac28a84e42696c8a28fb697d671a10d03fb95f0f /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent1969c2e312303faa458cf19dad9783165e3c72c8 (diff)
parentf749d88ae7574aa18aa527ad4d6345e98ea00a82 (diff)
downloadrust-69c78a98ee2fb1e96675beb50115495bffca9777.tar.gz
rust-69c78a98ee2fb1e96675beb50115495bffca9777.zip
Rollup merge of #85478 - FabianWolff:issue-85348, r=petrochenkov
Disallow shadowing const parameters

This pull request fixes #85348. Trying to shadow a `const` parameter as follows:
```rust
fn foo<const N: i32>() {
    let N @ _ = 0;
}
```
currently causes an ICE. With my changes, I get:
```
error[E0530]: let bindings cannot shadow const parameters
 --> test.rs:2:9
  |
1 | fn foo<const N: i32>() {
  |              - the const parameter `N` is defined here
2 |     let N @ _ = 0;
  |         ^ cannot be named the same as a const parameter

error: aborting due to previous error
```
This is the same error you get when trying to shadow a constant:
```rust
const N: i32 = 0;
let N @ _ = 0;
```
```
error[E0530]: let bindings cannot shadow constants
 --> src/lib.rs:3:5
  |
2 | const N: i32 = 0;
  | ----------------- the constant `N` is defined here
3 | let N @ _ = 0;
  |     ^ cannot be named the same as a constant

error: aborting due to previous error
```
The reason for disallowing shadowing in both cases is described [here](https://github.com/rust-lang/rust/issues/33118#issuecomment-233962221) (the comment there only talks about constants, but the same reasoning applies to `const` parameters).
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions