Refactor match checking to use HAIR#36695
Conversation
b085797 to
771f81f
Compare
src/librustc_mir/hair/mod.rs
Outdated
There was a problem hiding this comment.
Is moving parts of HAIR to rustc_const_eval a good idea? What about doing the opposite?
That is, move match checking to rustc_mir and perhaps even integrate it with MIR match building.
There was a problem hiding this comment.
Another idea would be to move it to rustc_typeck (and maybe have HAIR definitions in rustc).
There was a problem hiding this comment.
match checking uses a completely different algorithm than match building. HAIR patterns are basically independent of the rest of HAIR.
src/librustc_const_eval/_match.rs
Outdated
There was a problem hiding this comment.
/build/src/librustc_const_eval/_match.rs:477: TODO is deprecated; use FIXME
There was a problem hiding this comment.
The TODO is the entire point of this PR. It will be removed before the merge.
2200ac4 to
81fb5cf
Compare
|
☔ The latest upstream changes (presumably #36857) made this pull request unmergeable. Please resolve the merge conflicts. |
d03f2d5 to
879cf61
Compare
|
☔ The latest upstream changes (presumably #36814) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #37002) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #37039) made this pull request unmergeable. Please resolve the merge conflicts. |
0a402c9 to
b5d943d
Compare
`check_match` is now left with its grab bag of random checks.
no intended functional changes
NaN checking was a lint for a deprecated feature. It can go away.
b5d943d to
5cec1c3
Compare
Convert byte literal pattern to byte array patterns when they are both used together. so matching them is properly handled. I could've done the conversion eagerly, but that could have caused a bad worst-case for massive byte-array matches. Fixes rust-lang#18027. Fixes rust-lang#25051. Fixes rust-lang#26510.
5cec1c3 to
8d3e89b
Compare
nested slice patterns have the same functionality as non-nested ones, so flatten them in HAIR construction. Fixes rust-lang#26158.
eddyb
left a comment
There was a problem hiding this comment.
r=me with an explanation for the missing diagnostics, or a revert of their removal.
|
|
||
|
|
||
| E0003: r##" | ||
| /*E0003: r##" |
There was a problem hiding this comment.
What's with these two commented diagnostics?
There was a problem hiding this comment.
E0002 was merged into E0004, and E0003 refers to a feature that does not exist anymore.
| [NAN, _] => {}, | ||
| _ => {}, | ||
| }; | ||
| //~^^^ WARNING unmatchable NaN in pattern, use the is_nan method in a guard instead |
There was a problem hiding this comment.
Because you can't have floating-point patterns anymore.
|
@bors r=eddyb |
|
📌 Commit 4157850 has been approved by |
|
📌 Commit 3f9ebb4 has been approved by |
Refactor match checking to use HAIR Refactor match checking to use HAIR instead of HIR, fixing quite a few bugs in the process. r? @eddyb
Refactor match checking to use HAIR instead of HIR, fixing quite a few bugs in the process.
r? @eddyb