File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -732,6 +732,12 @@ impl<'a> Parser<'a> {
732732 format ! ( "expected {} here" , expect) ) )
733733 } ;
734734 let mut err = self . fatal ( & msg_exp) ;
735+ if self . token . is_ident_named ( "and" ) {
736+ err. help ( "Use `&&` instead of `and` for the boolean operator" ) ;
737+ }
738+ if self . token . is_ident_named ( "or" ) {
739+ err. help ( "Use `||` instead of `or` for the boolean operator" ) ;
740+ }
735741 let sp = if self . token == token:: Token :: Eof {
736742 // This is EOF, don't want to point at the following char, but rather the last token
737743 self . prev_span
@@ -4751,6 +4757,13 @@ impl<'a> Parser<'a> {
47514757 e. span_label ( sp, "expected `{`" ) ;
47524758 }
47534759
4760+ if self . token . is_ident_named ( "and" ) {
4761+ e. help ( "Use `&&` instead of `and` for the boolean operator" ) ;
4762+ }
4763+ if self . token . is_ident_named ( "or" ) {
4764+ e. help ( "Use `||` instead of `or` for the boolean operator" ) ;
4765+ }
4766+
47544767 // Check to see if the user has written something like
47554768 //
47564769 // if (cond)
You can’t perform that action at this time.
0 commit comments