File tree 1 file changed +17
-3
lines changed
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> {
1683
1683
match mode {
1684
1684
Mode :: Std | Mode :: ToolBootstrap | Mode :: ToolStd => { }
1685
1685
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.
1687
1688
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
1698
+ . lines ( )
1699
+ . any ( |line| line. contains ( "unsupported crate type `proc-macro`" ) ) ;
1700
+ if !not_supported {
1701
+ cargo. arg ( "-Zdual-proc-macros" ) ;
1702
+ rustflags. arg ( "-Zdual-proc-macros" ) ;
1703
+ }
1690
1704
}
1691
1705
}
1692
1706
}
You can’t perform that action at this time.
0 commit comments