File tree 4 files changed +3
-57
lines changed
4 files changed +3
-57
lines changed Original file line number Diff line number Diff line change @@ -121,31 +121,11 @@ impl Cache {
121
121
}
122
122
}
123
123
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
-
145
124
#[ inline]
146
- fn do_initialize ( value : Initializer ) {
125
+ fn initialize ( value : Initializer ) -> Initializer {
147
126
CACHE [ 0 ] . initialize ( ( value. 0 ) as usize & Cache :: MASK ) ;
148
127
CACHE [ 1 ] . initialize ( ( value. 0 >> Cache :: CAPACITY ) as usize & Cache :: MASK ) ;
128
+ value
149
129
}
150
130
151
131
// 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 {
170
150
///
171
151
/// It uses the `Feature` variant to index into this variable as a bitset. If
172
152
/// 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.
177
153
#[ inline]
178
154
pub ( crate ) fn test ( bit : u32 ) -> bool {
179
155
let ( relative_bit, idx) = if bit < Cache :: CAPACITY {
Original file line number Diff line number Diff line change @@ -69,13 +69,6 @@ macro_rules! features {
69
69
Feature :: _last => unreachable!( ) ,
70
70
}
71
71
}
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
- }
79
72
}
80
73
81
74
/// Each function performs run-time feature detection for a single
Original file line number Diff line number Diff line change 21
21
#![ no_std]
22
22
23
23
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" ) ] {
25
25
#[ cfg_attr( test, macro_use( println) ) ]
26
26
extern crate std;
27
27
Original file line number Diff line number Diff line change @@ -69,29 +69,6 @@ fn dump() {
69
69
println ! ( "rtm: {:?}" , is_x86_feature_detected!( "rtm" ) ) ;
70
70
}
71
71
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
-
95
72
#[ test]
96
73
fn compare_with_cupid ( ) {
97
74
let information = cupid:: master ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments