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> {
2882
2882
debug_assert ! ( ast_util:: is_comparison_binop( outer_op) ) ;
2883
2883
match lhs. node {
2884
2884
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 ) ;
2886
2887
self . span_err ( op_span,
2887
- "Chained comparison operators require parentheses" ) ;
2888
+ "chained comparison operators require parentheses" ) ;
2888
2889
if op. node == BiLt && outer_op == BiGt {
2889
2890
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" ) ;
2891
2892
}
2892
2893
}
2893
2894
_ => { }
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ fn f<T>() {}
12
12
13
13
fn main ( ) {
14
14
false == false == false ;
15
- //~^ ERROR: Chained comparison operators require parentheses
15
+ //~^ ERROR: chained comparison operators require parentheses
16
16
17
17
false == 0 < 2 ;
18
- //~^ ERROR: Chained comparison operators require parentheses
18
+ //~^ ERROR: chained comparison operators require parentheses
19
19
20
20
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 `<...>`
23
23
}
Original file line number Diff line number Diff line change @@ -15,6 +15,6 @@ fn f<X>() {}
15
15
pub fn main ( ) {
16
16
f<type>( ) ;
17
17
//~^ 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 ` ::<
20
20
}
You can’t perform that action at this time.
0 commit comments