File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1683,10 +1683,24 @@ impl<'a> Builder<'a> {
16831683 match mode {
16841684 Mode :: Std | Mode :: ToolBootstrap | Mode :: ToolStd => { }
16851685 Mode :: Rustc | Mode :: Codegen | Mode :: ToolRustc => {
1686- // Build proc macros both for the host and the target
1686+ // Build proc macros both for the host and the target unless proc-macros are not
1687+ // supported by the target.
16871688 if target != compiler. host && cmd_kind != Kind :: Check {
1688- cargo. arg ( "-Zdual-proc-macros" ) ;
1689- rustflags. arg ( "-Zdual-proc-macros" ) ;
1689+ let error = command ( & self . rustc ( compiler) )
1690+ . arg ( "--target" )
1691+ . arg ( target. rustc_target_arg ( ) )
1692+ . arg ( "--print=file-names" )
1693+ . arg ( "--crate-type=proc-macro" )
1694+ . arg ( "-" )
1695+ . run_capture ( self )
1696+ . stderr ( ) ;
1697+ let not_supported = error. lines ( ) . any ( |line| {
1698+ line. contains ( "unsupported crate type `proc-macro`" )
1699+ } ) ;
1700+ if !not_supported {
1701+ cargo. arg ( "-Zdual-proc-macros" ) ;
1702+ rustflags. arg ( "-Zdual-proc-macros" ) ;
1703+ }
16901704 }
16911705 }
16921706 }
You can’t perform that action at this time.
0 commit comments