Open
Description
Given the following code:
let mut a = std::mem::MaybeUninit::new(10);
unsafe { std::ptr::read(a.as_ptr()) } == 10;
Rust reports error:
error: expected expression, found `==`
--> src/main.rs:3:43
|
3 | unsafe { std::ptr::read(a.as_ptr()) } == 10;
| ^^ expected expression
However, if I change ==
to +
, Rust would instead mentions that a pair of parens should be added to wrap the block:
error: expected expression, found `+`
--> src/main.rs:3:43
|
3 | unsafe { std::ptr::read(a.as_ptr()) } + 10;
| ------------------------------------- ^ expected expression
| |
| help: parentheses are required to parse this as an expression: `(unsafe { std::ptr::read(a.as_ptr()) })`
I guess the error message should probably be updated for the ==
case as well.