mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: Suppress unused_unsafe warning
x86::__cpuid is safe on Rust ≥1.94 but unsafe on older versions. This causes unused_unsafe warnings when compiling with Rust ≥1.94. However, on earlier Rust versions, the code won’t compile if the unsafe blocks are absent. Work around this by adding #[allow(unused_unsafe)] where needed to suppress the warnings. See #7588 for more discussion. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
committed by
Bo Chen
parent
f6f0d49c62
commit
2e05836669
@@ -155,7 +155,8 @@ pub trait Hypervisor: Send + Sync {
|
||||
/// Determine CPU vendor
|
||||
///
|
||||
fn get_cpu_vendor(&self) -> CpuVendor {
|
||||
// SAFETY: call cpuid with valid leaves
|
||||
#[allow(unused_unsafe)]
|
||||
// SAFETY: not actually unsafe, but considered unsafe by current stable
|
||||
unsafe {
|
||||
let leaf = x86_64::__cpuid(0x0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user