@@ -902,6 +902,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
902
902
"min-llvm-version" ,
903
903
"min-system-llvm-version" ,
904
904
"needs-asm-support" ,
905
+ "needs-backends" ,
905
906
"needs-crate-type" ,
906
907
"needs-deterministic-layouts" ,
907
908
"needs-dlltool" ,
@@ -1663,6 +1664,7 @@ pub(crate) fn make_test_description<R: Read>(
1663
1664
decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
1664
1665
decision ! ( ignore_llvm( config, path, ln) ) ;
1665
1666
decision ! ( ignore_backends( config, path, ln) ) ;
1667
+ decision ! ( needs_backends( config, path, ln) ) ;
1666
1668
decision ! ( ignore_cdb( config, ln) ) ;
1667
1669
decision ! ( ignore_gdb( config, ln) ) ;
1668
1670
decision ! ( ignore_lldb( config, ln) ) ;
@@ -1809,6 +1811,29 @@ fn ignore_backends(config: &Config, path: &Utf8Path, line: &str) -> IgnoreDecisi
1809
1811
IgnoreDecision :: Continue
1810
1812
}
1811
1813
1814
+ fn needs_backends ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1815
+ if let Some ( needed_backends) = config. parse_name_value_directive ( line, "needs-backends" ) {
1816
+ if !needed_backends
1817
+ . split_whitespace ( )
1818
+ . map ( |backend| match CodegenBackend :: try_from ( backend) {
1819
+ Ok ( backend) => backend,
1820
+ Err ( error) => {
1821
+ panic ! ( "Invalid needs-backends value `{backend}` in `{path}`: {error}" )
1822
+ }
1823
+ } )
1824
+ . any ( |backend| config. codegen_backend == backend)
1825
+ {
1826
+ return IgnoreDecision :: Ignore {
1827
+ reason : format ! (
1828
+ "{} backend is not part of backends" ,
1829
+ config. codegen_backend. as_str( )
1830
+ ) ,
1831
+ } ;
1832
+ }
1833
+ }
1834
+ IgnoreDecision :: Continue
1835
+ }
1836
+
1812
1837
fn ignore_llvm ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1813
1838
if let Some ( needed_components) =
1814
1839
config. parse_name_value_directive ( line, "needs-llvm-components" )
0 commit comments