File tree 4 files changed +17
-0
lines changed
doc/rustc-dev-guide/src/tests
4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ settings:
158
158
159
159
- ` needs-asm-support ` — ignores if it is running on a target that doesn't have
160
160
stable support for ` asm! `
161
+ - ` needs-env-vars ` - ignores if the target doesn't support environment variables
161
162
- ` needs-profiler-runtime ` — ignores the test if the profiler runtime was not
162
163
enabled for the target
163
164
(` build.profiler = true ` in rustc's ` bootstrap.toml ` )
Original file line number Diff line number Diff line change @@ -520,6 +520,16 @@ impl Config {
520
520
|| self . target_cfg ( ) . os == "emscripten" ;
521
521
!unsupported_target
522
522
}
523
+
524
+ pub fn has_env_vars ( & self ) -> bool {
525
+ // As with some of the other target properties, we don't have a principled
526
+ // way to know whether the target supports environment variables, so we
527
+ // just hard-code a reasonable approximation.
528
+
529
+ let target = self . target_cfg ( ) ;
530
+ let no_env = matches ! ( target. arch. as_str( ) , "wasm32" | "wasm64" ) && target. os == "unknown" ;
531
+ !no_env
532
+ }
523
533
}
524
534
525
535
/// Known widths of `target_has_atomic`.
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
135
135
"needs-deterministic-layouts" ,
136
136
"needs-dlltool" ,
137
137
"needs-dynamic-linking" ,
138
+ "needs-env-vars" ,
138
139
"needs-enzyme" ,
139
140
"needs-force-clang-based-tests" ,
140
141
"needs-git-hash" ,
Original file line number Diff line number Diff line change @@ -174,6 +174,11 @@ pub(super) fn handle_needs(
174
174
condition : config. with_std_debug_assertions ,
175
175
ignore_reason : "ignored if std wasn't built with debug assertions" ,
176
176
} ,
177
+ Need {
178
+ name : "needs-env-vars" ,
179
+ condition : config. has_env_vars ( ) ,
180
+ ignore_reason : "ignored on targets without environment variables" ,
181
+ } ,
177
182
] ;
178
183
179
184
let ( name, rest) = match ln. split_once ( [ ':' , ' ' ] ) {
You can’t perform that action at this time.
0 commit comments