Consider the following code:
if mmap_size as usize < std::mem::size_of::<run>() {
...
}
This code has a precedence issue: as binds looser than <, so I think this attempts to parse what comes after the as as a type, usize<std::mem::size_of ..., parsing the < as a generic. That results in the following error message:
error: expected identifier, found `<`
--> src/main.rs:202:48
|
202 | if mmap_size as usize < std::mem::size_of::<run>() {
| ^
This leads the user down the wrong path. Ideally, rustc should provide an error that hints at the precedence issue instead.
Consider the following code:
This code has a precedence issue:
asbinds looser than<, so I think this attempts to parse what comes after theasas a type,usize<std::mem::size_of ..., parsing the<as a generic. That results in the following error message:This leads the user down the wrong path. Ideally, rustc should provide an error that hints at the precedence issue instead.