Why does this not work?
const _:() = unsafe {
const VAL: usize = std::mem::transmute(5_isize);
};
Here's the error:
warning: unnecessary `unsafe` block
--> src/lib.rs:1:14
|
1 | const _:() = unsafe {
| ^^^^^^ unnecessary `unsafe` block
|
= note: `#[warn(unused_unsafe)]` on by default
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> src/lib.rs:2:24
|
2 | const VAL: usize = std::mem::transmute(5_isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to previous error; 1 warning emitted