diff options
| author | P1start <rewi-github@whanau.org> | 2014-09-13 14:09:22 +1200 |
|---|---|---|
| committer | P1start <rewi-github@whanau.org> | 2014-10-03 20:39:56 +1300 |
| commit | 042cdeefc7708291057770ddd5becf14288dad71 (patch) | |
| tree | 8d93978d162a2ac1b0f2234b19f0ce9b04f10608 /src/libsyntax/parse/parser.rs | |
| parent | 45044124e46bbfd1ab9869ffce71259ae93866ff (diff) | |
| download | rust-042cdeefc7708291057770ddd5becf14288dad71.tar.gz rust-042cdeefc7708291057770ddd5becf14288dad71.zip | |
Correct error message for invalid `ref`/`mut` bindings
Closes #15914.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7cce9c2dc3a..d2735a425f5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3402,9 +3402,10 @@ impl<'a> Parser<'a> { binding_mode: ast::BindingMode) -> ast::Pat_ { if !is_plain_ident(&self.token) { - let last_span = self.last_span; - self.span_fatal(last_span, - "expected identifier, found path"); + let span = self.span; + let tok_str = self.this_token_to_string(); + self.span_fatal(span, + format!("expected identifier, found `{}`", tok_str).as_slice()); } let ident = self.parse_ident(); let last_span = self.last_span; |
