]> git.proxmox.com Git - cargo.git/commitdiff
Inform build scripts of rustc compiler context
authorJon Gjengset <jongje@amazon.com>
Fri, 18 Jun 2021 18:49:12 +0000 (11:49 -0700)
committerJon Gjengset <jongje@amazon.com>
Fri, 18 Jun 2021 18:49:15 +0000 (11:49 -0700)
Fixes #9600.

src/cargo/core/compiler/custom_build.rs

index ed13a9d3ed8bbe27efc18acbedef286935c9fb6c..4e4c64366c6c0c73aee4a40c841374f1f405f0bf 100644 (file)
@@ -249,6 +249,13 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
         }
     }
 
+    // Also inform the build script of the rustc compiler context.
+    cmd.env(
+        "CARGO_RUSTC_WRAPPER",
+        bcx.rustc().wrapper.as_deref().unwrap_or(Path::new("")),
+    );
+    cmd.env("CARGO_RUSTFLAGS", bcx.rustflags_args(unit).join(" "));
+
     // Gather the set of native dependencies that this package has along with
     // some other variables to close over.
     //