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> {
732
732
format ! ( "expected {} here" , expect) ) )
733
733
} ;
734
734
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
+ }
735
741
let sp = if self . token == token:: Token :: Eof {
736
742
// This is EOF, don't want to point at the following char, but rather the last token
737
743
self . prev_span
@@ -4751,6 +4757,13 @@ impl<'a> Parser<'a> {
4751
4757
e. span_label ( sp, "expected `{`" ) ;
4752
4758
}
4753
4759
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
+
4754
4767
// Check to see if the user has written something like
4755
4768
//
4756
4769
// if (cond)
You can’t perform that action at this time.
0 commit comments