diff options
| author | bors <bors@rust-lang.org> | 2019-12-22 07:01:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-22 07:01:50 +0000 |
| commit | 3982d3514efbb65b3efac6bb006b3fa496d16663 (patch) | |
| tree | 5fcfb7b8bd5ee606865be1abb448a4858f8c6770 /src/librustc_parse/parser/expr.rs | |
| parent | 005cf38f7e66757b32b03ea35fedca372eb063e3 (diff) | |
| parent | ca528fcc046aca3e1cccb74a4bbebe855df3e3b6 (diff) | |
| download | rust-3982d3514efbb65b3efac6bb006b3fa496d16663.tar.gz rust-3982d3514efbb65b3efac6bb006b3fa496d16663.zip | |
Auto merge of #67505 - Centril:rollup-7win7ty, r=Centril
Rollup of 6 pull requests Successful merges: - #67148 ( Refactor type & bounds parsing thoroughly) - #67410 (Reenable static linking of libstdc++ on windows-gnu) - #67439 (Cleanup `lower_pattern_unadjusted` & Improve slice pat typeck) - #67480 (Require issue = "none" over issue = "0" in unstable attributes) - #67500 (Tweak non_shorthand_field_patterns' suggestion) - #67504 (Warn against relying on ?Sized being last) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc_parse/parser/expr.rs')
| -rw-r--r-- | src/librustc_parse/parser/expr.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 159c2121d36..71c9e58f58f 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -90,6 +90,10 @@ impl<'a> Parser<'a> { self.parse_expr_res(Restrictions::empty(), None) } + pub(super) fn parse_anon_const_expr(&mut self) -> PResult<'a, AnonConst> { + self.parse_expr().map(|value| AnonConst { id: DUMMY_NODE_ID, value }) + } + fn parse_expr_catch_underscore(&mut self) -> PResult<'a, P<Expr>> { match self.parse_expr() { Ok(expr) => Ok(expr), @@ -109,7 +113,7 @@ impl<'a> Parser<'a> { } } - /// Parses a sequence of expressions bounded by parentheses. + /// Parses a sequence of expressions delimited by parentheses. fn parse_paren_expr_seq(&mut self) -> PResult<'a, Vec<P<Expr>>> { self.parse_paren_comma_seq(|p| { p.parse_expr_catch_underscore() @@ -955,10 +959,7 @@ impl<'a> Parser<'a> { let first_expr = self.parse_expr()?; if self.eat(&token::Semi) { // Repeating array syntax: `[ 0; 512 ]` - let count = AnonConst { - id: DUMMY_NODE_ID, - value: self.parse_expr()?, - }; + let count = self.parse_anon_const_expr()?; self.expect(close)?; ExprKind::Repeat(first_expr, count) } else if self.eat(&token::Comma) { |
