Skip to content

Commit 8a7fc37

Browse files
slpjakecorrenti
authored andcommitted
cpuid: allow unused unsafes
Rust 1.94 has switched a number of cpuid-related methods from unsafe to safe. We initially removed the "unsafe" block to make clippy happy, but this would make libkrun harder to package on distros that are a bit conservative with their Rust versions. Since there isn't any real impact, let's temporarily allow unused unsafes on the affected methods instead. Suggested-by: Daniel Müller <deso@posteo.net> Signed-off-by: Sergio Lopez <slp@redhat.com>
1 parent e0cf1f4 commit 8a7fc37

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/cpuid/src/brand_string.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ impl BrandString {
102102

103103
/// Creates a brand string, initialized from the CPUID leaves 0x80000002 through 0x80000004
104104
/// of the host CPU.
105+
#[allow(unused_unsafe)]
105106
pub fn from_host_cpuid() -> Result<Self, Error> {
106107
let mut this = Self::new();
107108
let mut cpuid_regs = unsafe { host_cpuid(0x8000_0000) };

src/cpuid/src/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub enum Error {
1818
}
1919

2020
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
21+
#[allow(unused_unsafe)]
2122
pub fn get_cpuid(function: u32, count: u32) -> Result<CpuidResult, Error> {
2223
// TODO: replace with validation based on `has_cpuid()` when it becomes stable:
2324
// https://doc.rust-lang.org/core/arch/x86/fn.has_cpuid.html

0 commit comments

Comments
 (0)