Adjust the error messages to match the pattern "expected foo, found bar"
Closes #8492
This commit is contained in:
parent
2e5aea65cd
commit
9968ae2554
118 changed files with 266 additions and 266 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue