Skip to content

Commit 1df0458

Browse files
committed
Auto merge of #128528 - workingjubilee:you-dont-need-to-see-this-cpuid-move-along, r=Amanieu
Finish removing `has_cpuid` The one use of it was guaranteed to be always true. try-job: test-various
2 parents fd8d6fb + 36527d6 commit 1df0458

File tree

4 files changed

+0
-30
lines changed

4 files changed

+0
-30
lines changed

library/std/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,6 @@
269269
#![cfg_attr(any(windows, target_os = "uefi"), feature(round_char_boundary))]
270270
#![cfg_attr(target_family = "wasm", feature(stdarch_wasm_atomic_wait))]
271271
#![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))]
272-
#![cfg_attr(
273-
all(any(target_arch = "x86_64", target_arch = "x86"), target_os = "uefi"),
274-
feature(stdarch_x86_has_cpuid)
275-
)]
276272
//
277273
// Language features:
278274
// tidy-alphabetical-start

library/std/src/sys/pal/uefi/time.rs

-8
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ pub(crate) mod instant_internal {
175175

176176
#[cfg(target_arch = "x86_64")]
177177
fn timestamp_rdtsc() -> Option<Duration> {
178-
if !crate::arch::x86_64::has_cpuid() {
179-
return None;
180-
}
181-
182178
static FREQUENCY: crate::sync::OnceLock<u64> = crate::sync::OnceLock::new();
183179

184180
// Get Frequency in Mhz
@@ -200,10 +196,6 @@ pub(crate) mod instant_internal {
200196

201197
#[cfg(target_arch = "x86")]
202198
fn timestamp_rdtsc() -> Option<Duration> {
203-
if !crate::arch::x86::has_cpuid() {
204-
return None;
205-
}
206-
207199
static FREQUENCY: crate::sync::OnceLock<u64> = crate::sync::OnceLock::new();
208200

209201
let freq = FREQUENCY

src/tools/rustfmt/tests/source/cfg_if/detect/os/x86.rs

-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ pub fn check_for(x: Feature) -> bool {
3434
fn detect_features() -> cache::Initializer {
3535
let mut value = cache::Initializer::default();
3636

37-
// If the x86 CPU does not support the CPUID instruction then it is too
38-
// old to support any of the currently-detectable features.
39-
if !has_cpuid() {
40-
return value;
41-
}
42-
43-
// Calling `__cpuid`/`__cpuid_count` from here on is safe because the CPU
44-
// has `cpuid` support.
45-
4637
// 0. EAX = 0: Basic Information:
4738
// - EAX returns the "Highest Function Parameter", that is, the maximum
4839
// leaf value for subsequent calls of `cpuinfo` in range [0,

src/tools/rustfmt/tests/target/cfg_if/detect/os/x86.rs

-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ pub fn check_for(x: Feature) -> bool {
3434
fn detect_features() -> cache::Initializer {
3535
let mut value = cache::Initializer::default();
3636

37-
// If the x86 CPU does not support the CPUID instruction then it is too
38-
// old to support any of the currently-detectable features.
39-
if !has_cpuid() {
40-
return value;
41-
}
42-
43-
// Calling `__cpuid`/`__cpuid_count` from here on is safe because the CPU
44-
// has `cpuid` support.
45-
4637
// 0. EAX = 0: Basic Information:
4738
// - EAX returns the "Highest Function Parameter", that is, the maximum
4839
// leaf value for subsequent calls of `cpuinfo` in range [0,

0 commit comments

Comments
 (0)