Skip to content

check_match: improve diagnostics for let A = 2; with const A: i32 = 3 - #64859

Merged
bors merged 1 commit into
rust-lang:masterfrom
Centril:const-def-here-new-var
Sep 28, 2019
Merged

check_match: improve diagnostics for let A = 2; with const A: i32 = 3#64859
bors merged 1 commit into
rust-lang:masterfrom
Centril:const-def-here-new-var

Conversation

@Centril

@CentrilCentril commented Sep 28, 2019

Copy link
Copy Markdown
Contributor

For example:

error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;
| ^
| |
| interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
...
LL | const A: i32 = 2;
| ----------------- constant defined here

r? @estebank
cc @matthiaskrgr@rpjohnst

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2019
@Centril
Centrilforce-pushed the const-def-here-new-var branch from 25531c8 to 03cfbd4CompareSeptember 28, 2019 00:42
Comment threadsrc/librustc_mir/hair/pattern/check_match.rs Outdated
Comment threadsrc/librustc_mir/hair/pattern/check_match.rs Outdated
where `A` is a constant, not a new variable.
@Centril
Centrilforce-pushed the const-def-here-new-var branch from 03cfbd4 to aa03f1fCompareSeptember 28, 2019 01:07
@estebank

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Sep 28, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit aa03f1f has been approved by estebank

@borsbors 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 Sep 28, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 28, 2019
…stebank
check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`
For example:
```
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;
| ^
| |
| interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
...
LL | const A: i32 = 2;
| ----------------- constant defined here
```
r? @estebank
cc @matthiaskrgr@rpjohnst
@CentrilCentril mentioned this pull request Sep 28, 2019
bors added a commit that referenced this pull request Sep 28, 2019
Rollup of 14 pull requests
Successful merges:
- #64703 (Docs: slice elements are equidistant)
- #64745 (Include message on tests that should panic but do not)
- #64781 (Remove stray references to the old global tcx)
- #64794 (Remove unused DepTrackingMap)
- #64802 (Account for tail expressions when pointing at return type)
- #64809 (hir: Disallow `target_feature` on constants)
- #64815 (Fix div_duration() marked as stable by mistake)
- #64818 (update rtpSpawn's parameters type(It's prototype has been updated in libc))
- #64830 (Thou shallt not `.abort_if_errors()`)
- #64836 (Stabilize map_get_key_value feature)
- #64845 (pin.rs: fix links to primitives in documentation)
- #64847 (Upgrade env_logger to 0.7)
- #64851 (Add mailmap entry for Dustin Bensing by request)
- #64859 (check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`)
Failed merges:
r? @ghost
@bors
bors merged commit aa03f1f into rust-lang:masterSep 28, 2019
@Centril
Centril deleted the const-def-here-new-var branch September 28, 2019 07:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Centril@estebank@bors@varkor@rust-highfive