diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-25 16:26:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-25 16:26:18 +0200 |
| commit | da7812785a7c1eb2654e8d09a0ba31fab0858712 (patch) | |
| tree | 4a4affcccc7dd47d85cf09d4ea5daa278d153e00 /src/libsyntax/parse/parser | |
| parent | b30238e3125a6c1ebf95cf47e58566efc75ad2f1 (diff) | |
| parent | 0918dc4e5990592c28484d1d64bec41cb9a4a301 (diff) | |
| download | rust-da7812785a7c1eb2654e8d09a0ba31fab0858712.tar.gz rust-da7812785a7c1eb2654e8d09a0ba31fab0858712.zip | |
Rollup merge of #64508 - Centril:or-pat-hir, r=matthewjasper
or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR
Following up on work in https://github.com/rust-lang/rust/pull/64111, https://github.com/rust-lang/rust/pull/63693, and https://github.com/rust-lang/rust/pull/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`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html#method.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 https://github.com/rust-lang/rust/pull/63688.
- AST borrowck (`construct.rs`) is not adjusted as AST borrowck will be removed soon.
r? @matthewjasper
cc @dlrobertson @varkor @oli-obk
Diffstat (limited to 'src/libsyntax/parse/parser')
0 files changed, 0 insertions, 0 deletions
