Code
I tried this code:
fn main() {
let a = unsafe { core::arch::x86_64::__cpuid_count(0, 0) };
dbg!(a);
}
I expected to see this happen: it compiles without warnings.
Instead, this happened: it compiles with a warning of unnecessary unsafe block
warning: unnecessary `unsafe` block
--> src/main.rs:2:13
|
2 | let a = unsafe { core::arch::x86_64::__cpuid_count(0, 0) };
| ^^^^^^ unnecessary `unsafe` block
|
= note: `#[warn(unused_unsafe)]` (part of `#[warn(unused)]`) on by default
Version it worked on
Stable channel 1.93.0 doesn't emit that.
Version with regression
Beta channel 1.94.0-beta.2 emits that. (2026-01-25 23a44d3)
Nightly channel 1.95.0-nightly emits that. (2026-02-08 6efa357)
The code can be reproduced on the present plaground: stable vs beta.
Code
I tried this code:
I expected to see this happen: it compiles without warnings.
Instead, this happened: it compiles with a warning of unnecessary
unsafeblockVersion it worked on
Stable channel 1.93.0 doesn't emit that.
Version with regression
Beta channel 1.94.0-beta.2 emits that. (2026-01-25 23a44d3)
Nightly channel 1.95.0-nightly emits that. (2026-02-08 6efa357)
The code can be reproduced on the present plaground: stable vs beta.