diff options
| author | bors <bors@rust-lang.org> | 2019-09-06 07:37:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-06 07:37:41 +0000 |
| commit | 1fb3c4ec7ca37d33bd1e68cce669d171c2752615 (patch) | |
| tree | 48ea5150538790309c68b9f515c4e958724a82a5 /src/libsyntax/parse | |
| parent | 6b5f9b2e973e438fc1726a2d164d046acd80b170 (diff) | |
| parent | 61fcd057d2524175a21e2eb1d49c1d4aec29a0be (diff) | |
| download | rust-1fb3c4ec7ca37d33bd1e68cce669d171c2752615.tar.gz rust-1fb3c4ec7ca37d33bd1e68cce669d171c2752615.zip | |
Auto merge of #64209 - Centril:rollup-x9kvjb7, r=Centril
Rollup of 10 pull requests Successful merges: - #63676 (Use wasi crate for Core API) - #64094 (Improve searching in rustdoc and add tests) - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve) - #64156 (Assume non-git LLVM is fresh if the stamp file exists) - #64161 (Point at variant on pattern field count mismatch) - #64174 (Add missing code examples on Iterator trait) - #64175 (Fix invalid span generation when it should be div) - #64186 (std: Improve downstream codegen in `Command::env`) - #64190 (fill metadata in rustc_lexer's Cargo.toml) - #64198 (Add Fuchsia to actually_monotonic) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser/expr.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/pat.rs | 10 |
2 files changed, 3 insertions, 15 deletions
diff --git a/src/libsyntax/parse/parser/expr.rs b/src/libsyntax/parse/parser/expr.rs index e502a08f4b2..3db9c899dba 100644 --- a/src/libsyntax/parse/parser/expr.rs +++ b/src/libsyntax/parse/parser/expr.rs @@ -1250,8 +1250,7 @@ impl<'a> Parser<'a> { /// The `let` token has already been eaten. fn parse_let_expr(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr>> { let lo = self.prev_span; - // FIXME(or_patterns, Centril | dlrobertson): use `parse_top_pat` instead. - let pat = self.parse_top_pat_unpack(GateOr::No)?; + let pat = self.parse_top_pat(GateOr::No)?; self.expect(&token::Eq)?; let expr = self.with_res( Restrictions::NO_STRUCT_LITERAL, @@ -1393,8 +1392,7 @@ impl<'a> Parser<'a> { crate fn parse_arm(&mut self) -> PResult<'a, Arm> { let attrs = self.parse_outer_attributes()?; let lo = self.token.span; - // FIXME(or_patterns, Centril | dlrobertson): use `parse_top_pat` instead. - let pat = self.parse_top_pat_unpack(GateOr::No)?; + let pat = self.parse_top_pat(GateOr::No)?; let guard = if self.eat_keyword(kw::If) { Some(self.parse_expr()?) } else { @@ -1455,7 +1453,7 @@ impl<'a> Parser<'a> { Ok(ast::Arm { attrs, - pats: pat, // FIXME(or_patterns, Centril | dlrobertson): this should just be `pat,`. + pat, guard, body: expr, span: lo.to(hi), diff --git a/src/libsyntax/parse/parser/pat.rs b/src/libsyntax/parse/parser/pat.rs index 823f880337d..669f657160b 100644 --- a/src/libsyntax/parse/parser/pat.rs +++ b/src/libsyntax/parse/parser/pat.rs @@ -36,16 +36,6 @@ impl<'a> Parser<'a> { self.parse_pat_with_range_pat(true, expected) } - // FIXME(or_patterns, Centril | dlrobertson): - // remove this and use `parse_top_pat` everywhere it is used instead. - pub(super) fn parse_top_pat_unpack(&mut self, gate_or: GateOr) -> PResult<'a, Vec<P<Pat>>> { - self.parse_top_pat(gate_or) - .map(|pat| pat.and_then(|pat| match pat.node { - PatKind::Or(pats) => pats, - node => vec![self.mk_pat(pat.span, node)], - })) - } - /// Entry point to the main pattern parser. /// Corresponds to `top_pat` in RFC 2535 and allows or-pattern at the top level. pub(super) fn parse_top_pat(&mut self, gate_or: GateOr) -> PResult<'a, P<Pat>> { |
