Skip to content

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Jun 4, 2023

Given the code

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 PR extends the note for type ascription of a constant pattern to AscribeUserType patterns which have Constant subpatterns.

Fixes #112269.

…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.
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 4, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2023

Some changes might have occurred in exhaustiveness checking

cc @Nadrieril

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 4, 2023

📌 Commit 55b4549 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2023
@bors
Copy link
Collaborator

bors commented Jun 5, 2023

⌛ Testing commit 55b4549 with merge e410606...

@bors
Copy link
Collaborator

bors commented Jun 5, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing e410606 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 5, 2023
@bors bors merged commit e410606 into rust-lang:master Jun 5, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 5, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e410606): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.0% [-3.0%, -3.0%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 646.008s -> 646.537s (0.08%)

@jieyouxu jieyouxu deleted the issue-112269 branch December 20, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

very weird warning when using same varname for const and let binding
6 participants