diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-10-04 11:24:18 +0200 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-10-04 12:25:48 +0200 |
| commit | 68034f837a39387e49fc7d7c5b088f5372a1127e (patch) | |
| tree | 0e3ec5d7475c034650c390196e64d399e5778669 /src/bootstrap | |
| parent | 6414d9f52dd8c9e31ce0c923a4327583b794bb43 (diff) | |
| download | rust-68034f837a39387e49fc7d7c5b088f5372a1127e.tar.gz rust-68034f837a39387e49fc7d7c5b088f5372a1127e.zip | |
Disable -Zdual-proc-macros if the target doesn't support proc-macros
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 47420f8fe72..837ea276d13 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -1683,10 +1683,24 @@ impl<'a> Builder<'a> { match mode { Mode::Std | Mode::ToolBootstrap | Mode::ToolStd => {} Mode::Rustc | Mode::Codegen | Mode::ToolRustc => { - // Build proc macros both for the host and the target + // Build proc macros both for the host and the target unless proc-macros are not + // supported by the target. if target != compiler.host && cmd_kind != Kind::Check { - cargo.arg("-Zdual-proc-macros"); - rustflags.arg("-Zdual-proc-macros"); + let error = command(self.rustc(compiler)) + .arg("--target") + .arg(target.rustc_target_arg()) + .arg("--print=file-names") + .arg("--crate-type=proc-macro") + .arg("-") + .run_capture(self) + .stderr(); + let not_supported = error + .lines() + .any(|line| line.contains("unsupported crate type `proc-macro`")); + if !not_supported { + cargo.arg("-Zdual-proc-macros"); + rustflags.arg("-Zdual-proc-macros"); + } } } } |
