Repository navigation
Show note for type ascription on a local binding interpreted as a constant pattern and not a new variable - #112272
Conversation
…a new variable
Given the code
```rust
pub fn main() {
const y: i32 = 4;
let y: i32 = 3;
}
```
`y` in the let binding is actually interpreted as a constant pattern
and is not a new variable, causing confusing diagnostics about
refutable patterns in local binding.
This commit extends the note for type ascription as a constant pattern
to `AscribeUserType` patterns as well.
|
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
|
Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
|
@bors r+ |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (e410606): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 646.008s -> 646.537s (0.08%) |
Given the code
yin the let binding is actually interpreted as a constant pattern and is not a new variable, causing confusing diagnostics about refutable patterns in local binding.This PR extends the note for type ascription of a constant pattern to
AscribeUserTypepatterns which haveConstantsubpatterns.Fixes #112269.