You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0133]: call to unsafe function requires unsafe function or block
--> src/main.rs:4:28
|
4 | const MAGIC: i32 = mem::transmute([1u8, 2, 3, 4]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
It is misleading, because the call is in fact inside an unsafe block. Expected output:
error[E0015]: calls in constants are limited to struct and enum constructors
On the current nightly the problem is even worse because the compiler also warns about an unused unsafe block, while at the same time telling that an unsafe block is required.
The text was updated successfully, but these errors were encountered:
The following code generates a misleading error message on Rust 1.20.0:
Observed output:
It is misleading, because the call is in fact inside an unsafe block. Expected output:
On the current nightly the problem is even worse because the compiler also warns about an unused unsafe block, while at the same time telling that an unsafe block is required.
The text was updated successfully, but these errors were encountered: