Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wangjiezhe/1ceae0cd942ae9c97b929cf8619937ee to your computer and use it in GitHub Desktop.

Select an option

Save wangjiezhe/1ceae0cd942ae9c97b929cf8619937ee to your computer and use it in GitHub Desktop.

Revisions

  1. wangjiezhe revised this gist Jan 12, 2025. No changes.
  2. wangjiezhe created this gist Dec 8, 2024.
    46 changes: 46 additions & 0 deletions Revert-Disable-Zdual-proc-macros-if-the-target-doesn.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    From 0740d1682a043c41fb7154414535e83767f60a32 Mon Sep 17 00:00:00 2001
    From: wangjiezhe <[email protected]>
    Date: Sun, 8 Dec 2024 23:55:55 +0800
    Subject: [PATCH] Revert "Disable -Zdual-proc-macros if the target doesn't
    support proc-macros"

    This reverts commit 68034f837a39387e49fc7d7c5b088f5372a1127e.
    ---
    src/bootstrap/src/core/builder.rs | 20 +++-----------------
    1 file changed, 3 insertions(+), 17 deletions(-)

    diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
    index 9ac0b0a01f7..0ac9697ba29 100644
    --- a/src/bootstrap/src/core/builder.rs
    +++ b/src/bootstrap/src/core/builder.rs
    @@ -1698,24 +1698,10 @@ fn cargo(
    match mode {
    Mode::Std | Mode::ToolBootstrap | Mode::ToolStd => {}
    Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {
    - // Build proc macros both for the host and the target unless proc-macros are not
    - // supported by the target.
    + // Build proc macros both for the host and the target
    if target != compiler.host && cmd_kind != Kind::Check {
    - 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");
    - }
    + cargo.arg("-Zdual-proc-macros");
    + rustflags.arg("-Zdual-proc-macros");
    }
    }
    }
    --
    2.45.2