@@ -902,6 +902,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
902902 "min-llvm-version" ,
903903 "min-system-llvm-version" ,
904904 "needs-asm-support" ,
905+ "needs-backends" ,
905906 "needs-crate-type" ,
906907 "needs-deterministic-layouts" ,
907908 "needs-dlltool" ,
@@ -1663,6 +1664,7 @@ pub(crate) fn make_test_description<R: Read>(
16631664 decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
16641665 decision ! ( ignore_llvm( config, path, ln) ) ;
16651666 decision ! ( ignore_backends( config, path, ln) ) ;
1667+ decision ! ( needs_backends( config, path, ln) ) ;
16661668 decision ! ( ignore_cdb( config, ln) ) ;
16671669 decision ! ( ignore_gdb( config, ln) ) ;
16681670 decision ! ( ignore_lldb( config, ln) ) ;
@@ -1809,6 +1811,29 @@ fn ignore_backends(config: &Config, path: &Utf8Path, line: &str) -> IgnoreDecisi
18091811 IgnoreDecision :: Continue
18101812}
18111813
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+
18121837fn ignore_llvm ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
18131838 if let Some ( needed_components) =
18141839 config. parse_name_value_directive ( line, "needs-llvm-components" )
0 commit comments