diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index df9c55ce0be3..2768d9c7f04f 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -159,7 +159,7 @@ fn main() { cmd.arg("-C").arg("panic=abort"); } - if cfg!(not(feature="llvm")) && stage != "0" { + if env::var("RUSTC_LLVM_ENABLED") == Ok("0".to_string()) && stage != "0" { cmd.arg("-Zno-trans"); } diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index de6dd10938e6..99712d9fcab7 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -539,6 +539,12 @@ impl<'a> Builder<'a> { .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler)); } + if self.build.config.llvm_enabled { + cargo.env("RUSTC_LLVM_ENABLED", "1"); + } else { + cargo.env("RUSTC_LLVM_ENABLED", "0"); + } + // Ignore incremental modes except for stage0, since we're // not guaranteeing correctness across builds if the compiler // is changing under your feet.` diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index d6155f53485e..dabe15b6a6e6 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -41,4 +41,4 @@ syntax_pos = { path = "../libsyntax_pos" } ar = "0.3.0" [features] -llvm = ["rustc_trans"] +llvm = ["rustc_trans", "rustc_metadata/llvm"] diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 40b75be36fef..2c17797ed5dd 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -21,3 +21,6 @@ serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } syntax_ext = { path = "../libsyntax_ext" } syntax_pos = { path = "../libsyntax_pos" } + +[features] +llvm = []