@@ -908,6 +908,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
908
908
"min-llvm-version" ,
909
909
"min-system-llvm-version" ,
910
910
"needs-asm-support" ,
911
+ "needs-backends" ,
911
912
"needs-crate-type" ,
912
913
"needs-deterministic-layouts" ,
913
914
"needs-dlltool" ,
@@ -1671,6 +1672,7 @@ pub(crate) fn make_test_description<R: Read>(
1671
1672
decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
1672
1673
decision ! ( ignore_llvm( config, path, ln) ) ;
1673
1674
decision ! ( ignore_backends( config, path, ln) ) ;
1675
+ decision ! ( needs_backends( config, path, ln) ) ;
1674
1676
decision ! ( ignore_cdb( config, ln) ) ;
1675
1677
decision ! ( ignore_gdb( config, ln) ) ;
1676
1678
decision ! ( ignore_lldb( config, ln) ) ;
@@ -1817,6 +1819,29 @@ fn ignore_backends(config: &Config, path: &Utf8Path, line: &str) -> IgnoreDecisi
1817
1819
IgnoreDecision :: Continue
1818
1820
}
1819
1821
1822
+ fn needs_backends ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1823
+ if let Some ( needed_backends) = config. parse_name_value_directive ( line, "needs-backends" ) {
1824
+ if !needed_backends
1825
+ . split_whitespace ( )
1826
+ . map ( |backend| match CodegenBackend :: try_from ( backend) {
1827
+ Ok ( backend) => backend,
1828
+ Err ( error) => {
1829
+ panic ! ( "Invalid needs-backends value `{backend}` in `{path}`: {error}" )
1830
+ }
1831
+ } )
1832
+ . any ( |backend| config. codegen_backend == backend)
1833
+ {
1834
+ return IgnoreDecision :: Ignore {
1835
+ reason : format ! (
1836
+ "{} backend is not part of required backends" ,
1837
+ config. codegen_backend. as_str( )
1838
+ ) ,
1839
+ } ;
1840
+ }
1841
+ }
1842
+ IgnoreDecision :: Continue
1843
+ }
1844
+
1820
1845
fn ignore_llvm ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1821
1846
if let Some ( needed_components) =
1822
1847
config. parse_name_value_directive ( line, "needs-llvm-components" )
0 commit comments