Skip to content

Commit 21105ea

Browse files
authored
cpufeatures: fix cfg for freestanding x86 targets (#1137)
Previously we were using an empty string for `target_os` to indicate freestanding targets which is incorrect. We should use `none` instead.
1 parent e74e578 commit 21105ea

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cpufeatures/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## UNRELEASED
9+
### Fixed
10+
- `cfg` for freestanding x86 targets ([#1137])
11+
12+
[#1137]: https://github.com/RustCrypto/utils/pull/1137
13+
814
## 0.2.15 (2024-11-11)
915
### Fixed
1016
- Relax XSAVE checks ([#1130])

cpufeatures/src/x86.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ macro_rules! __unless_target_features {
1414
($($tf:tt),+ => $body:expr ) => {{
1515
#[cfg(not(all($(target_feature=$tf,)*)))]
1616
{
17-
#[cfg(not(any(target_env = "sgx", target_os = "", target_os = "uefi")))]
17+
#[cfg(not(any(target_env = "sgx", target_os = "none", target_os = "uefi")))]
1818
$body
1919

2020
// CPUID is not available on SGX. Freestanding and UEFI targets
2121
// do not support SIMD features with default compilation flags.
22-
#[cfg(any(target_env = "sgx", target_os = "", target_os = "uefi"))]
22+
#[cfg(any(target_env = "sgx", target_os = "none", target_os = "uefi"))]
2323
false
2424
}
2525

0 commit comments

Comments
 (0)