-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Show note for type ascription on a local binding interpreted as a constant pattern and not a new variable #112272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
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 PR extends the note for type ascription of a constant pattern to
AscribeUserType
patterns which haveConstant
subpatterns.Fixes #112269.