Skip to content

Commit 0ba9870

Browse files
committed
Remove std_detect_env_override
1 parent 6af519d commit 0ba9870

File tree

4 files changed

+3
-57
lines changed

4 files changed

+3
-57
lines changed

crates/std_detect/src/detect/cache.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -121,31 +121,11 @@ impl Cache {
121121
}
122122
}
123123

124-
cfg_if::cfg_if! {
125-
if #[cfg(feature = "std_detect_env_override")] {
126-
#[inline]
127-
fn initialize(mut value: Initializer) -> Initializer {
128-
if let Ok(disable) = crate::env::var("RUST_STD_DETECT_UNSTABLE") {
129-
for v in disable.split(" ") {
130-
let _ = super::Feature::from_str(v).map(|v| value.unset(v as u32));
131-
}
132-
}
133-
do_initialize(value);
134-
value
135-
}
136-
} else {
137-
#[inline]
138-
fn initialize(value: Initializer) -> Initializer {
139-
do_initialize(value);
140-
value
141-
}
142-
}
143-
}
144-
145124
#[inline]
146-
fn do_initialize(value: Initializer) {
125+
fn initialize(value: Initializer) -> Initializer {
147126
CACHE[0].initialize((value.0) as usize & Cache::MASK);
148127
CACHE[1].initialize((value.0 >> Cache::CAPACITY) as usize & Cache::MASK);
128+
value
149129
}
150130

151131
// We only have to detect features once, and it's fairly costly, so hint to LLVM
@@ -170,10 +150,6 @@ fn detect_and_initialize() -> Initializer {
170150
///
171151
/// It uses the `Feature` variant to index into this variable as a bitset. If
172152
/// the bit is set, the feature is enabled, and otherwise it is disabled.
173-
///
174-
/// If the feature `std_detect_env_override` is enabled looks for the env
175-
/// variable `RUST_STD_DETECT_UNSTABLE` and uses its its content to disable
176-
/// Features that would had been otherwise detected.
177153
#[inline]
178154
pub(crate) fn test(bit: u32) -> bool {
179155
let (relative_bit, idx) = if bit < Cache::CAPACITY {

crates/std_detect/src/detect/macros.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ macro_rules! features {
6969
Feature::_last => unreachable!(),
7070
}
7171
}
72-
#[cfg(feature = "std_detect_env_override")]
73-
pub(crate) fn from_str(s: &str) -> Result<Feature, ()> {
74-
match s {
75-
$($feature_lit => Ok(Feature::$feature),)*
76-
_ => Err(())
77-
}
78-
}
7972
}
8073

8174
/// Each function performs run-time feature detection for a single

crates/std_detect/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#![no_std]
2222

2323
cfg_if::cfg_if! {
24-
if #[cfg(any(feature = "std_detect_file_io", feature = "std_detect_env_override"))] {
24+
if #[cfg(feature = "std_detect_file_io")] {
2525
#[cfg_attr(test, macro_use(println))]
2626
extern crate std;
2727

crates/std_detect/tests/x86-specific.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,6 @@ fn dump() {
6969
println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
7070
}
7171

72-
#[cfg(feature = "std_detect_env_override")]
73-
#[test]
74-
fn env_override_no_avx() {
75-
if let Ok(disable) = std::env::var("RUST_STD_DETECT_UNSTABLE") {
76-
let information = cupid::master().unwrap();
77-
for d in disable.split(" ") {
78-
match d {
79-
"avx" => {
80-
if information.avx() {
81-
assert_ne!(is_x86_feature_detected!("avx"), information.avx())
82-
}
83-
}
84-
"avx2" => {
85-
if information.avx2() {
86-
assert_ne!(is_x86_feature_detected!("avx2"), information.avx2())
87-
}
88-
}
89-
_ => {}
90-
}
91-
}
92-
}
93-
}
94-
9572
#[test]
9673
fn compare_with_cupid() {
9774
let information = cupid::master().unwrap();

0 commit comments

Comments
 (0)