about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2018-06-30 10:45:14 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2018-07-07 10:56:07 +0200
commitff12beb8756f028d44f898a91960ed70102a4792 (patch)
treeb1a12ec881a468e12040479d16923c0ae6aba52a
parent163cb572a491cb3eb7f2c792415c93840cb7e9c0 (diff)
downloadrust-ff12beb8756f028d44f898a91960ed70102a4792.tar.gz
rust-ff12beb8756f028d44f898a91960ed70102a4792.zip
Revert changes to bootstrap, rustc_driver and fix {core,std}simd
-rw-r--r--config.toml.example8
-rw-r--r--src/bootstrap/bin/rustc.rs5
-rw-r--r--src/bootstrap/builder.rs6
-rw-r--r--src/bootstrap/compile.rs27
-rw-r--r--src/bootstrap/config.rs4
-rw-r--r--src/bootstrap/test.rs4
-rw-r--r--src/bootstrap/tool.rs2
-rw-r--r--src/libcore/lib.rs7
-rw-r--r--src/librustc/session/config.rs12
-rw-r--r--src/librustc_driver/lib.rs14
-rw-r--r--src/libstd/lib.rs8
11 files changed, 36 insertions, 61 deletions
diff --git a/config.toml.example b/config.toml.example
index 0de2cce5679..0578f929224 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -14,6 +14,10 @@
 # =============================================================================
 [llvm]
 
+# Indicates whether rustc will support compilation with LLVM
+# note: rustc does not compile without LLVM at the moment
+#enabled = true
+
 # Indicates whether the LLVM build is a Release or Debug build
 #optimize = true
 
@@ -330,8 +334,8 @@
 # This is an array of the codegen backends that will be compiled for the rustc
 # that's being compiled. The default is to only build the LLVM codegen backend,
 # but you can also optionally enable the "emscripten" backend for asm.js or
-# make this an empty array (which will disable LLVM, but that probably won't
-# get too far in the bootstrap)
+# make this an empty array (but that probably won't get too far in the
+# bootstrap)
 #codegen-backends = ["llvm"]
 
 # This is the name of the directory in which codegen backends will get installed
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 04882426fd8..4607ca5cf9f 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -107,11 +107,6 @@ fn main() {
              env::join_paths(&dylib_path).unwrap());
     let mut maybe_crate = None;
 
-    // Don't use metadata only backend for snapshot compiler, because it may be broken
-    if env::var("RUSTC_SHOULD_USE_METADATA_ONLY_BACKEND").is_err() {
-        cmd.arg("--cfg").arg("codegen_backend=\"llvm\"");
-    }
-
     // Print backtrace in case of ICE
     if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
         cmd.env("RUST_BACKTRACE", "1");
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 7e4a12f7310..fad0a553802 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -747,10 +747,6 @@ impl<'a> Builder<'a> {
             stage = compiler.stage;
         }
 
-        if self.config.rust_codegen_backends.is_empty() {
-            cargo.env("RUSTC_SHOULD_USE_METADATA_ONLY_BACKEND", "1");
-        }
-
         let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
         if stage != 0 {
             let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
@@ -897,7 +893,7 @@ impl<'a> Builder<'a> {
         //
         // If LLVM support is disabled we need to use the snapshot compiler to compile
         // build scripts, as the new compiler doesn't support executables.
-        if mode == Mode::Std || self.config.rust_codegen_backends.is_empty() {
+        if mode == Mode::Std || !self.config.llvm_enabled {
             cargo
                 .env("RUSTC_SNAPSHOT", &self.initial_rustc)
                 .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 524df9587da..298bd58c6cd 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -182,13 +182,11 @@ pub fn std_cargo(builder: &Builder,
             // missing
             // We also only build the runtimes when --enable-sanitizers (or its
             // config.toml equivalent) is used
-            if !builder.config.rust_codegen_backends.is_empty() {
-                let llvm_config = builder.ensure(native::Llvm {
-                    target: builder.config.build,
-                    emscripten: false,
-                });
-                cargo.env("LLVM_CONFIG", llvm_config);
-            }
+            let llvm_config = builder.ensure(native::Llvm {
+                target: builder.config.build,
+                emscripten: false,
+            });
+            cargo.env("LLVM_CONFIG", llvm_config);
         }
 
         cargo.arg("--features").arg(features)
@@ -645,13 +643,14 @@ impl Step for CodegenBackend {
 
     fn make_run(run: RunConfig) {
         let backend = run.builder.config.rust_codegen_backends.get(0);
-        if let Some(backend) = backend.cloned() {
-            run.builder.ensure(CodegenBackend {
-                compiler: run.builder.compiler(run.builder.top_stage, run.host),
-                target: run.target,
-                backend,
-            });
-        }
+        let backend = backend.cloned().unwrap_or_else(|| {
+            INTERNER.intern_str("llvm")
+        });
+        run.builder.ensure(CodegenBackend {
+            compiler: run.builder.compiler(run.builder.top_stage, run.host),
+            target: run.target,
+            backend,
+        });
     }
 
     fn run(self, builder: &Builder) {
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 2e629456b7e..b3ed10257bd 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -74,6 +74,7 @@ pub struct Config {
     pub backtrace_on_ice: bool,
 
     // llvm codegen options
+    pub llvm_enabled: bool,
     pub llvm_assertions: bool,
     pub llvm_optimize: bool,
     pub llvm_release_debuginfo: bool,
@@ -238,6 +239,7 @@ struct Install {
 #[derive(Deserialize, Default)]
 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
 struct Llvm {
+    enabled: Option<bool>,
     ccache: Option<StringOrBool>,
     ninja: Option<bool>,
     assertions: Option<bool>,
@@ -339,6 +341,7 @@ impl Config {
 
     pub fn default_opts() -> Config {
         let mut config = Config::default();
+        config.llvm_enabled = true;
         config.llvm_optimize = true;
         config.llvm_version_check = true;
         config.use_jemalloc = true;
@@ -493,6 +496,7 @@ impl Config {
                 Some(StringOrBool::Bool(false)) | None => {}
             }
             set(&mut config.ninja, llvm.ninja);
+            set(&mut config.llvm_enabled, llvm.enabled);
             llvm_assertions = llvm.assertions;
             set(&mut config.llvm_optimize, llvm.optimize);
             set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 917b85690de..6254f981656 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1096,7 +1096,7 @@ impl Step for Compiletest {
             cmd.arg("--quiet");
         }
 
-        if !builder.config.rust_codegen_backends.is_empty() {
+        if builder.config.llvm_enabled {
             let llvm_config = builder.ensure(native::Llvm {
                 target: builder.config.build,
                 emscripten: false,
@@ -1129,7 +1129,7 @@ impl Step for Compiletest {
                 }
             }
         }
-        if suite == "run-make-fulldeps" && builder.config.rust_codegen_backends.is_empty() {
+        if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
             builder.info(&format!(
                 "Ignoring run-make test suite as they generally don't work without LLVM"
             ));
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 640dd9ecdd9..b3d7b9a91ec 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -672,7 +672,7 @@ impl<'a> Builder<'a> {
     }
 
     fn llvm_bin_path(&self) -> Option<PathBuf> {
-        if !self.config.rust_codegen_backends.is_empty() && !self.config.dry_run {
+        if self.config.llvm_enabled && !self.config.dry_run {
             let llvm_config = self.ensure(native::Llvm {
                 target: self.config.build,
                 emscripten: false,
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 0971f50913c..bbe6ae8619f 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -241,13 +241,12 @@ macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*)
 #[path = "../stdsimd/coresimd/mod.rs"]
 #[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)]
 #[unstable(feature = "stdsimd", issue = "48556")]
-// allow changes to how stdsimd works in stage0 and don't use whithout LLVM
-#[cfg(all(not(stage0), codegen_backend="llvm"))]
+#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
 mod coresimd;
 
 #[unstable(feature = "stdsimd", issue = "48556")]
-#[cfg(all(not(stage0), codegen_backend="llvm"))]
+#[cfg(not(stage0))]
 pub use coresimd::simd;
 #[stable(feature = "simd_arch", since = "1.27.0")]
-#[cfg(all(not(stage0), codegen_backend="llvm"))]
+#[cfg(not(stage0))]
 pub use coresimd::arch;
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 05e08cb7973..95c68214ec7 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1418,18 +1418,6 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
     if sess.opts.crate_types.contains(&CrateTypeProcMacro) {
         ret.insert((Symbol::intern("proc_macro"), None));
     }
-    /*if nightly_options::is_nightly_build() {
-        let backend_name = sess.opts
-            .debugging_opts
-            .codegen_backend
-            .as_ref()
-            .map(|s| s as &str)
-            .unwrap_or("llvm");
-        ret.insert((
-            Symbol::intern("codegen_backend"),
-            Some(Symbol::intern(backend_name)),
-        ));
-    }*/
     return ret;
 }
 
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 321d398b521..84f7b35d21f 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -375,20 +375,10 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<CodegenBackend> {
     match file {
         Some(ref s) => return load_backend_from_dylib(s),
         None => {
-            if !::rustc::session::config::nightly_options::is_nightly_build() {
-                let err = format!("failed to load default codegen backend for `{}`, \
+            let err = format!("failed to load default codegen backend for `{}`, \
                                no appropriate codegen dylib found in `{}`",
                                backend_name, sysroot.display());
-                early_error(ErrorOutputType::default(), &err);
-            } else {
-                let warn = format!("no codegen-backend `{}`, \
-                               no appropriate dylib in `{}`. \
-                               Falling back to metadata_only codegen backend. \
-                               **This is suitable for dev purposes only**",
-                               backend_name, sysroot.display());
-                early_warn(ErrorOutputType::default(), &warn);
-                return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new;
-            }
+            early_error(ErrorOutputType::default(), &err);
         }
     }
 
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index d79f851a3d7..d73cb1f8349 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -523,22 +523,22 @@ pub mod rt;
 #[path = "../stdsimd/stdsimd/mod.rs"]
 #[allow(missing_debug_implementations, missing_docs, dead_code)]
 #[unstable(feature = "stdsimd", issue = "48556")]
-#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
+#[cfg(all(not(stage0), not(test)))]
 mod stdsimd;
 
 // A "fake" module needed by the `stdsimd` module to compile, not actually
 // exported though.
-#[cfg(all(not(stage0), codegen_backend="llvm"))]
+#[cfg(not(stage0))]
 mod coresimd {
     pub use core::arch;
     pub use core::simd;
 }
 
 #[unstable(feature = "stdsimd", issue = "48556")]
-#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
+#[cfg(all(not(stage0), not(test)))]
 pub use stdsimd::simd;
 #[stable(feature = "simd_arch", since = "1.27.0")]
-#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
+#[cfg(all(not(stage0), not(test)))]
 pub use stdsimd::arch;
 
 // Include a number of private modules that exist solely to provide