Open
Description
This code:
fn uwu() {
unsafe {
#[forbid(unsafe_code)]
let owo = (&1 as *const i32).read();
dbg!(owo);
}
}
Does not produce an error for using unsafe code in an expression that is annotated with a forbid(unsafe_code)
Instead, this happened: program compiled without any output
The same issue occurs in several similar scenarios, such as inside an unsafe fn
(when unsafe_op_in_unsafe_fn
is not enabled)
unsafe fn uwu() {
#[forbid(unsafe_code)]
{
let owo = (&1 as *const i32).read();
dbg!(owo);
}
}
Meta
Reproduces on all of current stable, beta, and nightly:
Stable 1.65.0
Beta 1.66.0-beta.2
Nightly 1.67.0 2022-11-26 80a9646