Suggest non-ambiguous comparison after cast
```
warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison
--> $DIR/issue-22644.rs:16:33
|
16 | println!("{}", a as usize < b);
| ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here
|
help: if you want to compare the casted value then write
| println!("{}", (a as usize) < b);
```
This commit is contained in:
parent
a6d32153a6
commit
3a7dbf48fe
4 changed files with 43 additions and 2 deletions
20
src/test/ui/issue-22644.stderr
Normal file
20
src/test/ui/issue-22644.stderr
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison
|
||||
--> $DIR/issue-22644.rs:16:33
|
||||
|
|
||||
16 | println!("{}", a as usize < b);
|
||||
| ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here
|
||||
|
|
||||
help: if you want to compare the casted value then write
|
||||
| println!("{}", (a as usize) < b);
|
||||
|
||||
warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison
|
||||
--> $DIR/issue-22644.rs:17:33
|
||||
|
|
||||
17 | println!("{}", a as usize < 4);
|
||||
| -^ unexpected token
|
||||
| |
|
||||
| expected one of `>`, identifier, lifetime, or type here
|
||||
|
|
||||
help: if you want to compare the casted value then write
|
||||
| println!("{}", (a as usize) < 4);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue