diff options
| author | Jonas Hietala <tradet.h@gmail.com> | 2014-08-23 12:41:32 +0200 | 
|---|---|---|
| committer | Jonas Hietala <tradet.h@gmail.com> | 2014-08-24 09:53:01 +0200 | 
| commit | 9968ae255495704cb0c3fc1f43d2df2e84c20d5e (patch) | |
| tree | 9812a6ca9aa9325047cba5294fdc1dc5b5ff1e97 /src/libsyntax/parse | |
| parent | 2e5aea65cd2594f19b9043d8df0e6461504cda9b (diff) | |
| download | rust-9968ae255495704cb0c3fc1f43d2df2e84c20d5e.tar.gz rust-9968ae255495704cb0c3fc1f43d2df2e84c20d5e.zip | |
Adjust the error messages to match the pattern "expected foo, found bar"
Closes #8492
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 20 | 
2 files changed, 11 insertions, 11 deletions
| diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 550dbfdab71..eca02d06ca9 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -92,7 +92,7 @@ impl<'a> ParserAttr for Parser<'a> { } _ => { let token_str = self.this_token_to_string(); - self.fatal(format!("expected `#` but found `{}`", + self.fatal(format!("expected `#`, found `{}`", token_str).as_slice()); } }; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9e2829e6380..e798ca0e38a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -413,7 +413,7 @@ impl<'a> Parser<'a> { } else { let token_str = Parser::token_to_string(t); let this_token_str = self.this_token_to_string(); - self.fatal(format!("expected `{}` but found `{}`", + self.fatal(format!("expected `{}`, found `{}`", token_str, this_token_str).as_slice()) } @@ -447,11 +447,11 @@ impl<'a> Parser<'a> { let actual = self.this_token_to_string(); self.fatal( (if expected.len() != 1 { - (format!("expected one of `{}` but found `{}`", + (format!("expected one of `{}`, found `{}`", expect, actual)) } else { - (format!("expected `{}` but found `{}`", + (format!("expected `{}`, found `{}`", expect, actual)) }).as_slice() @@ -1314,7 +1314,7 @@ impl<'a> Parser<'a> { _ => { let token_str = p.this_token_to_string(); - p.fatal((format!("expected `;` or `{{` but found `{}`", + p.fatal((format!("expected `;` or `{{`, found `{}`", token_str)).as_slice()) } } @@ -3375,7 +3375,7 @@ impl<'a> Parser<'a> { "" }; let tok_str = self.this_token_to_string(); - self.fatal(format!("expected {}`(` or `{{`, but found `{}`", + self.fatal(format!("expected {}`(` or `{{`, found `{}`", ident_str, tok_str).as_slice()) } @@ -3924,7 +3924,7 @@ impl<'a> Parser<'a> { }, _ => { let token_str = self.this_token_to_string(); - self.fatal(format!("expected `self` but found `{}`", + self.fatal(format!("expected `self`, found `{}`", token_str).as_slice()) } } @@ -4455,7 +4455,7 @@ impl<'a> Parser<'a> { } else { let token_str = self.this_token_to_string(); self.fatal(format!("expected `{}`, `(`, or `;` after struct \ - name but found `{}`", "{", + name, found `{}`", "{", token_str).as_slice()) } @@ -4486,7 +4486,7 @@ impl<'a> Parser<'a> { let span = self.span; let token_str = self.this_token_to_string(); self.span_fatal(span, - format!("expected `,`, or `}}` but found `{}`", + format!("expected `,`, or `}}`, found `{}`", token_str).as_slice()) } } @@ -4566,7 +4566,7 @@ impl<'a> Parser<'a> { } _ => { let token_str = self.this_token_to_string(); - self.fatal(format!("expected item but found `{}`", + self.fatal(format!("expected item, found `{}`", token_str).as_slice()) } } @@ -5107,7 +5107,7 @@ impl<'a> Parser<'a> { let span = self.span; let token_str = self.this_token_to_string(); self.span_fatal(span, - format!("expected `{}` or `fn` but found `{}`", "{", + format!("expected `{}` or `fn`, found `{}`", "{", token_str).as_slice()); } | 
