Skip to content

or-patterns: Push PatKind/PatternKind::Or at top level to HIR & HAIR - #64508

Merged
bors merged 22 commits into
rust-lang:masterfrom
Centril:or-pat-hir
Sep 25, 2019
Merged

or-patterns: Push PatKind/PatternKind::Or at top level to HIR & HAIR#64508
bors merged 22 commits into
rust-lang:masterfrom
Centril:or-pat-hir

Conversation

@Centril

@Centril Centril commented Sep 16, 2019

Copy link
Copy Markdown
Contributor

Following up on work in #64111, #63693, and #61708, in this PR:

  • We change hair::Arm.patterns: Vec<Pattern<'_>> into hir::Arm.pattern: Pattern<'_>.

    • fn hair::Arm::top_pats_hack is introduced as a temporary crutch in MIR building to avoid more changes.
  • We change hir::Arm.pats: HirVec<P<Pat>> into hir::Arm.pat: P<Pat>.

    • The hacks in rustc::hir::lowering are removed since the representation hack is no longer necessary.

    • In some places, fn hir::Arm::top_pats_hack is 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_n is redefined as a "reference pattern" in fn is_non_ref_pat for now. This is done so that reference types are not eagerly stripped from the expected: Ty<'tcx>.

    • Liveness is adjusted wrt. the unused_variables and unused_assignments lints to handle top/inner levels uniformly and the handling of fn parameters, let locals, and match arms 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

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-or_patterns `#![feature(or_patterns)]` S-waiting-on-bors Status: 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.

6 participants