File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
166166 "needs-subprocess" ,
167167 "needs-symlink" ,
168168 "needs-target-has-atomic" ,
169+ "needs-target-std" ,
169170 "needs-threads" ,
170171 "needs-unwind" ,
171172 "needs-wasmtime" ,
Original file line number Diff line number Diff line change @@ -174,6 +174,11 @@ pub(super) fn handle_needs(
174174 condition : config. with_std_debug_assertions ,
175175 ignore_reason : "ignored if std wasn't built with debug assertions" ,
176176 } ,
177+ Need {
178+ name : "needs-target-std" ,
179+ condition : build_helper:: targets:: target_supports_std ( & config. target ) ,
180+ ignore_reason : "ignored if target does not support std" ,
181+ } ,
177182 ] ;
178183
179184 let ( name, rest) = match ln. split_once ( [ ':' , ' ' ] ) {
Original file line number Diff line number Diff line change @@ -945,3 +945,14 @@ fn test_ignore_auxiliary() {
945945 let config = cfg ( ) . build ( ) ;
946946 assert ! ( check_ignore( & config, "//@ ignore-auxiliary" ) ) ;
947947}
948+
949+ #[ test]
950+ fn test_needs_target_std ( ) {
951+ // Cherry-picks two targets:
952+ // 1. `x86_64-unknown-none`: Tier 2, intentionally never supports std.
953+ // 2. `x86_64-unknown-linux-gnu`: Tier 1, always supports std.
954+ let config = cfg ( ) . target ( "x86_64-unknown-none" ) . build ( ) ;
955+ assert ! ( check_ignore( & config, "//@ needs-target-std" ) ) ;
956+ let config = cfg ( ) . target ( "x86_64-unknown-linux-gnu" ) . build ( ) ;
957+ assert ! ( !check_ignore( & config, "//@ needs-target-std" ) ) ;
958+ }
You can’t perform that action at this time.
0 commit comments