-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use a separate pattern type for rustc_pattern_analysis
diagnostics
#128430
Conversation
This further reduces the amount of code that relies on `thir::Pat` being printable.
This reverts commit ae0ec73. The original change in rust-lang#128304 was intended to be a step towards being able to print `thir::Pat` even after switching to `PatId`. But because the only patterns that need to be printed are the synthetic ones created by pattern analysis (for diagnostic purposes only), it makes more sense to completely separate the printable patterns from the real THIR patterns.
The pattern-analysis code needs to print patterns, as part of its user-visible diagnostics. But it never actually tries to print "real" patterns! Instead, it only ever prints synthetic patterns that it has reconstructed from its own internal represenations. We can therefore simultaneously remove two obstacles to changing `thir::Pat`, by having the pattern-analysis code use its own dedicated type for building printable patterns, and then making `thir::Pat` not printable at all.
Some changes occurred in exhaustiveness checking cc @Nadrieril |
I've performed basic simplifications on |
Did you try printing |
I did look into printing Trying to print |
That said, I'll have another try at printing |
Oh yeah, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good
Btw, no need to make the printing of |
What I plan to do next is to add a special Once that's done, all the printing logic will have naturally migrated into |
Sounds good! Let's merge this first then. @bors r+ |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#126454 (bump-stage0: use IndexMap for determinism) - rust-lang#127681 (derive(SmartPointer): rewrite bounds in where and generic bounds) - rust-lang#127830 (When an archive fails to build, print the path) - rust-lang#128151 (Structured suggestion for `extern crate foo` when `foo` isn't resolved in import) - rust-lang#128387 (More detailed note to deprecate ONCE_INIT) - rust-lang#128388 (Match LLVM ABI in `extern "C"` functions for `f128` on Windows) - rust-lang#128402 (Attribute checking simplifications) - rust-lang#128412 (Remove `crate_level_only` from `ELIDED_LIFETIMES_IN_PATHS`) - rust-lang#128430 (Use a separate pattern type for `rustc_pattern_analysis` diagnostics ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128430 - Zalathar:print-pat, r=Nadrieril Use a separate pattern type for `rustc_pattern_analysis` diagnostics The pattern-analysis code needs to print patterns, as part of its user-visible diagnostics. But it never actually tries to print "real" patterns! Instead, it only ever prints synthetic patterns that it has reconstructed from its own internal represenations. We can therefore simultaneously remove two obstacles to changing `thir::Pat`, by having the pattern-analysis code use its own dedicated type for building printable patterns, and then making `thir::Pat` not printable at all. r? `@Nadrieril`
Preliminary cleanup of `WitnessPat` hoisting/printing Follow-up to rust-lang#128430. The eventual goal is to remove `print::Pat` entirely, but in the course of working towards that I made so many small improvements that it seems wise to let those be reviewed/merged on their own first. Best reviewed commit-by-commit, most of which should be pretty simple and straightforward. r? `@Nadrieril`
Preliminary cleanup of `WitnessPat` hoisting/printing Follow-up to rust-lang#128430. The eventual goal is to remove `print::Pat` entirely, but in the course of working towards that I made so many small improvements that it seems wise to let those be reviewed/merged on their own first. Best reviewed commit-by-commit, most of which should be pretty simple and straightforward. r? ``@Nadrieril``
Rollup merge of rust-lang#128536 - Zalathar:print-cleanup, r=Nadrieril Preliminary cleanup of `WitnessPat` hoisting/printing Follow-up to rust-lang#128430. The eventual goal is to remove `print::Pat` entirely, but in the course of working towards that I made so many small improvements that it seems wise to let those be reviewed/merged on their own first. Best reviewed commit-by-commit, most of which should be pretty simple and straightforward. r? ``@Nadrieril``
The pattern-analysis code needs to print patterns, as part of its user-visible diagnostics. But it never actually tries to print "real" patterns! Instead, it only ever prints synthetic patterns that it has reconstructed from its own internal represenations.
We can therefore simultaneously remove two obstacles to changing
thir::Pat
, by having the pattern-analysis code use its own dedicated type for building printable patterns, and then makingthir::Pat
not printable at all.r? @Nadrieril