Improve code reuse between trans/_match.rs and check_match.rs#15078
Conversation
src/librustc/middle/pat_util.rs
Outdated
There was a problem hiding this comment.
I believe there's a fn wild() in middle/check_match.rs, which is not public and can be consolidated into this one.
|
@pnkfelix Can you review? |
|
@brson I can review, but probably not until tomorrow morning (Eastern TZ). |
src/librustc/middle/trans/_match.rs
Outdated
There was a problem hiding this comment.
Please alpha-rename this type item to enter_pats (plural).
|
Okay it looks good to me, or at least does appear to be a plausible refactoring of the code, assuming that there is a good reason that I could not find code analogous to the original reorder-to-struct-def. r=me after the nits regarding the |
|
@pnkfelix This should be green now. I added a note below that dialogue comment. I think most of it is outdated now but I'll wait with removing it until I've finished the summer cleaning here. :-) |
|
Oh, to be fair, I also scraped the uniq_str_eq_fn lang item. |
|
@jakub- hmm that travis failure looks relevant and troubling: "task ' ' failed at 'internal error: entered unreachable code', /home/travis/build/rust-lang/rust/src/test/run-pass/vec-matching-fixed.rs:14" |
The specialization logic for patterns is really the same in both exhaustiveness/reachability checking and codegen.
|
@pnkfelix Yeah, I've gone a bit too far. It's green now. |
…=pnkfelix I believe there's more commonality to be found there but maybe small steps are better. I'm also in the process of documenting what I can, I will see if I can add it to this PR. It also seems to me that ideally some of this stuff (especially the pattern sanity check) could live as a separate compiler-agnostic module but I understand this may not be the right time (if not the worst) to start the process of modularising rustc.
…g#15078) Fixes: rust-lang/rust-clippy#14980 changelog: Fix suggestion-cases-error of [`empty_line_after_outer_attr`]
I believe there's more commonality to be found there but maybe small steps are better. I'm also in the process of documenting what I can, I will see if I can add it to this PR.
It also seems to me that ideally some of this stuff (especially the pattern sanity check) could live as a separate compiler-agnostic module but I understand this may not be the right time (if not the worst) to start the process of modularising rustc.