diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-04-15 08:08:46 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-04-19 10:13:45 -0700 |
| commit | f1be8d16c55990fff8c265352328fd90555feabd (patch) | |
| tree | 99c16d9f73b4cf921c383eb1bc226d906211267b /src/libsyntax/parse/parser.rs | |
| parent | 2f36b54f0f33427e926872935c325a660967af6f (diff) | |
| download | rust-f1be8d16c55990fff8c265352328fd90555feabd.tar.gz rust-f1be8d16c55990fff8c265352328fd90555feabd.zip | |
Identify missing ambiguous case with best effort suggestion
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7d130470c6a..a82b1e11a52 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2856,7 +2856,7 @@ impl<'a> Parser<'a> { hi = self.prev_span; ex = ExprKind::Mac(respan(lo.to(hi), Mac_ { path, tts, delim })); } else if self.check(&token::OpenDelim(token::Brace)) { - if let Some(expr) = self.should_parse_struct_expr(lo, path.clone(), attrs.clone()) { + if let Some(expr) = self.should_parse_struct_expr(lo, &path, &attrs) { return expr; } else { hi = path.span; @@ -2907,8 +2907,8 @@ impl<'a> Parser<'a> { fn should_parse_struct_expr( &mut self, lo: Span, - path: ast::Path, - attrs: ThinVec<Attribute>, + path: &ast::Path, + attrs: &ThinVec<Attribute>, ) -> Option<PResult<'a, P<Expr>>> { let could_be_struct = self.look_ahead(1, |t| t.is_ident()) && ( self.look_ahead(2, |t| *t == token::Colon) @@ -2924,7 +2924,7 @@ impl<'a> Parser<'a> { parse_struct = true; } if parse_struct { - match self.parse_struct_expr(lo, path, attrs) { + match self.parse_struct_expr(lo, path.clone(), attrs.clone()) { Err(err) => return Some(Err(err)), Ok(expr) => { if bad_struct { |
