File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -2882,12 +2882,13 @@ impl<'a> Parser<'a> {
28822882 debug_assert ! ( ast_util:: is_comparison_binop( outer_op) ) ;
28832883 match lhs. node {
28842884 ExprBinary ( op, _, _) if ast_util:: is_comparison_binop ( op. node ) => {
2885- let op_span = self . span ;
2885+ // respan to include both operators
2886+ let op_span = mk_sp ( op. span . lo , self . span . hi ) ;
28862887 self . span_err ( op_span,
2887- "Chained comparison operators require parentheses" ) ;
2888+ "chained comparison operators require parentheses" ) ;
28882889 if op. node == BiLt && outer_op == BiGt {
28892890 self . span_help ( op_span,
2890- "use ::< instead of < if you meant to specify type arguments" ) ;
2891+ "use ` ::<...>` instead of `<...>` if you meant to specify type arguments" ) ;
28912892 }
28922893 }
28932894 _ => { }
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ fn f<T>() {}
1212
1313fn main ( ) {
1414 false == false == false ;
15- //~^ ERROR: Chained comparison operators require parentheses
15+ //~^ ERROR: chained comparison operators require parentheses
1616
1717 false == 0 < 2 ;
18- //~^ ERROR: Chained comparison operators require parentheses
18+ //~^ ERROR: chained comparison operators require parentheses
1919
2020 f<X >( ) ;
21- //~^ ERROR: Chained comparison operators require parentheses
22- //~^^ HELP: use ::< instead of < if you meant to specify type arguments
21+ //~^ ERROR: chained comparison operators require parentheses
22+ //~^^ HELP: use ` ::<...>` instead of `<...>`
2323}
Original file line number Diff line number Diff line change @@ -15,6 +15,6 @@ fn f<X>() {}
1515pub fn main ( ) {
1616 f<type>( ) ;
1717 //~^ ERROR expected identifier, found keyword `type`
18- //~^^ ERROR: Chained comparison operators require parentheses
19- //~^^^ HELP: use ::< instead of < if you meant to specify type arguments
18+ //~^^ ERROR: chained comparison
19+ //~^^^ HELP: use ` ::<
2020}
You can’t perform that action at this time.
0 commit comments