or-patterns: Push PatKind/PatternKind::Or at top level to HIR & HAIR - #64508
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on work in #64111, #63693, and #61708, in this PR:
We change
hair::Arm.patterns: Vec<Pattern<'_>>intohir::Arm.pattern: Pattern<'_>.fn hair::Arm::top_pats_hackis introduced as a temporary crutch in MIR building to avoid more changes.We change
hir::Arm.pats: HirVec<P<Pat>>intohir::Arm.pat: P<Pat>.The hacks in
rustc::hir::loweringare removed since the representation hack is no longer necessary.In some places,
fn hir::Arm::top_pats_hackis introduced to leave some things as future work.Misc changes: HIR pretty printing is adjusted to behave uniformly wrt. top/inner levels, rvalue promotion is adjusted, regionck, and dead_code is also.
Type checking is adjusted to uniformly handle or-patterns at top/inner levels.
To make things compile,
p_0 | ... | p_nis redefined as a "reference pattern" infn is_non_ref_patfor now. This is done so that reference types are not eagerly stripped from theexpected: Ty<'tcx>.Liveness is adjusted wrt. the
unused_variablesandunused_assignmentslints to handle top/inner levels uniformly and the handling offnparameters,letlocals, andmatcharms are unified in this respect. This is not tested for now as exhaustiveness checks are reachable and will ICE.In
check_match, checking@and by-move bindings is adjusted. However, exhaustiveness checking is not adjusted the moment and is handled by @dlrobertson in WIP: Initial implementation of or-pattern handling in MIR #63688.AST borrowck (
construct.rs) is not adjusted as AST borrowck will be removed soon.r? @matthewjasper
cc @dlrobertson @varkor @oli-obk