@@ -732,6 +732,12 @@ impl<'a> Parser<'a> {
|
|||||||
format!("expected {} here", expect)))
|
format!("expected {} here", expect)))
|
||||||
};
|
};
|
||||||
let mut err = self.fatal(&msg_exp);
|
let mut err = self.fatal(&msg_exp);
|
||||||
|
if self.token.is_ident_named("and") {
|
||||||
|
err.help("Use `&&` instead of `and` for the boolean operator");
|
||||||
|
}
|
||||||
|
if self.token.is_ident_named("or") {
|
||||||
|
err.help("Use `||` instead of `or` for the boolean operator");
|
||||||
|
}
|
||||||
let sp = if self.token == token::Token::Eof {
|
let sp = if self.token == token::Token::Eof {
|
||||||
// This is EOF, don't want to point at the following char, but rather the last token
|
// This is EOF, don't want to point at the following char, but rather the last token
|
||||||
self.prev_span
|
self.prev_span
|
||||||
@@ -4751,6 +4757,13 @@ impl<'a> Parser<'a> {
|
|||||||
e.span_label(sp, "expected `{`");
|
e.span_label(sp, "expected `{`");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.token.is_ident_named("and") {
|
||||||
|
e.help("Use `&&` instead of `and` for the boolean operator");
|
||||||
|
}
|
||||||
|
if self.token.is_ident_named("or") {
|
||||||
|
e.help("Use `||` instead of `or` for the boolean operator");
|
||||||
|
}
|
||||||
|
|
||||||
// Check to see if the user has written something like
|
// Check to see if the user has written something like
|
||||||
//
|
//
|
||||||
// if (cond)
|
// if (cond)
|
||||||
|
|||||||
Reference in New Issue
Block a user