File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
crates/std_detect/src/detect Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -125,9 +125,16 @@ cfg_if::cfg_if! {
125
125
if #[ cfg( feature = "std_detect_env_override" ) ] {
126
126
#[ inline]
127
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 ) ) ;
128
+ let env = unsafe {
129
+ libc:: getenv( b"RUST_STD_DETECT_UNSTABLE\0 " . as_ptr( ) as * const libc:: c_char)
130
+ } ;
131
+ if !env. is_null( ) {
132
+ let len = unsafe { libc:: strlen( env) } ;
133
+ let env = unsafe { core:: slice:: from_raw_parts( env as * const u8 , len) } ;
134
+ if let Ok ( disable) = core:: str :: from_utf8( env) {
135
+ for v in disable. split( " " ) {
136
+ let _ = super :: Feature :: from_str( v) . map( |v| value. unset( v as u32 ) ) ;
137
+ }
131
138
}
132
139
}
133
140
do_initialize( value) ;
You can’t perform that action at this time.
0 commit comments