]> git.lizzy.rs Git - rust.git/commitdiff
Stub out less code
authorMark Simulacrum <mark.simulacrum@gmail.com>
Thu, 15 Mar 2018 23:29:53 +0000 (17:29 -0600)
committerMark Simulacrum <mark.simulacrum@gmail.com>
Tue, 3 Apr 2018 17:41:51 +0000 (11:41 -0600)
src/bootstrap/builder.rs
src/bootstrap/compile.rs
src/bootstrap/doc.rs
src/bootstrap/lib.rs
src/bootstrap/tool.rs
src/bootstrap/util.rs

index 80136aa86e3e23667cee1492163994df89a55c03..49d4864190aee530c0fd70fa9ee77bc1f1ffa86c 100644 (file)
@@ -691,7 +691,7 @@ pub fn cargo(&self,
         // the options through environment variables that are fetched and understood by both.
         //
         // FIXME: the guard against msvc shouldn't need to be here
-        if !target.contains("msvc") && !cfg!(test) {
+        if !target.contains("msvc") {
             let ccache = self.config.ccache.as_ref();
             let ccacheify = |s: &Path| {
                 let ccache = match ccache {
@@ -874,6 +874,8 @@ mod __test {
 
     fn configure(host: &[&str], target: &[&str]) -> Config {
         let mut config = Config::default_opts();
+        // don't save toolstates
+        config.save_toolstates = None;
         config.run_host_only = true;
         config.build = INTERNER.intern_str("A");
         config.hosts = vec![config.build].clone().into_iter()
index d1a6a8d12a7c394fbc4b1b32dfc7cc33dcb03dcc..daf25a36d47748066310e54f177107f44b744cc2 100644 (file)
@@ -722,7 +722,6 @@ fn run(self, builder: &Builder) {
 fn copy_codegen_backends_to_sysroot(builder: &Builder,
                                     compiler: Compiler,
                                     target_compiler: Compiler) {
-    if cfg!(test) { return; }
     let build = builder.build;
     let target = target_compiler.host;
 
index 5f3d9ecfc042d5666449346aeaf26f8a496a8d52..44073a5b0757237bda2fe96abb1aa873e6432756 100644 (file)
@@ -817,7 +817,6 @@ fn run(self, builder: &Builder) {
 }
 
 fn symlink_dir_force(src: &Path, dst: &Path) -> io::Result<()> {
-    if cfg!(test) { return Ok(()); }
     if let Ok(m) = fs::symlink_metadata(dst) {
         if m.file_type().is_dir() {
             try!(fs::remove_dir_all(dst));
index b7c8150a7dab97c6ae2e3918db82013ba576a445..fca265fe41c26f1435d71c97c4ebc7dfcfa795b3 100644 (file)
@@ -367,20 +367,20 @@ pub fn new(config: Config) -> Build {
         cc_detect::find(&mut build);
         build.verbose("running sanity check");
         sanity::check(&mut build);
-        if !cfg!(test) {
-            // If local-rust is the same major.minor as the current version, then force a
-            // local-rebuild
-            let local_version_verbose = output(
-                Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
-            let local_release = local_version_verbose
-                .lines().filter(|x| x.starts_with("release:"))
-                .next().unwrap().trim_left_matches("release:").trim();
-            let my_version = channel::CFG_RELEASE_NUM;
-            if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
-                build.verbose(&format!("auto-detected local-rebuild {}", local_release));
-                build.local_rebuild = true;
-            }
+
+        // If local-rust is the same major.minor as the current version, then force a
+        // local-rebuild
+        let local_version_verbose = output(
+            Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
+        let local_release = local_version_verbose
+            .lines().filter(|x| x.starts_with("release:"))
+            .next().unwrap().trim_left_matches("release:").trim();
+        let my_version = channel::CFG_RELEASE_NUM;
+        if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
+            build.verbose(&format!("auto-detected local-rebuild {}", local_release));
+            build.local_rebuild = true;
         }
+
         build.verbose("learning about cargo");
         metadata::build(&mut build);
 
@@ -426,7 +426,6 @@ pub fn build(&mut self) {
     ///
     /// After this executes, it will also ensure that `dir` exists.
     fn clear_if_dirty(&self, dir: &Path, input: &Path) -> bool {
-        if cfg!(test) { return true; }
         let stamp = dir.join(".stamp");
         let mut cleared = false;
         if mtime(&stamp) < mtime(input) {
@@ -697,7 +696,6 @@ fn cxx(&self, target: Interned<String>) -> Result<&Path, String> {
 
     /// Returns the path to the linker for the given target if it needs to be overridden.
     fn linker(&self, target: Interned<String>) -> Option<&Path> {
-        if cfg!(test) { return None; }
         if let Some(linker) = self.config.target_config.get(&target)
                                                        .and_then(|c| c.linker.as_ref()) {
             Some(linker)
index 362ec0c3b5085751b10000d629a4a620fd28c58f..2bb46cc5171d61b0881782f5474eb2aee3dee461 100644 (file)
@@ -199,11 +199,7 @@ fn run(self, builder: &Builder) -> Option<PathBuf> {
 
         if !is_expected {
             if !is_ext_tool {
-                if cfg!(test) {
-                    panic!("unexpected failure -- would have hard exited");
-                } else {
-                    exit(1);
-                }
+                exit(1);
             } else {
                 return None;
             }
index 99d0548a05e7f896bd7918c519441471f62192b4..f3f4278d3290110194163e8a40ec22753be64540 100644 (file)
@@ -34,7 +34,6 @@ pub fn staticlib(name: &str, target: &str) -> String {
 
 /// Copies a file from `src` to `dst`
 pub fn copy(src: &Path, dst: &Path) {
-    if cfg!(test) { return; }
     let _ = fs::remove_file(&dst);
     // Attempt to "easy copy" by creating a hard link (symlinks don't work on
     // windows), but if that fails just fall back to a slow `copy` operation.
@@ -67,7 +66,6 @@ pub fn replace_in_file(path: &Path, replacements: &[(&str, &str)]) {
 }
 
 pub fn read_stamp_file(stamp: &Path) -> Vec<PathBuf> {
-    if cfg!(test) { return vec![]; }
     let mut paths = Vec::new();
     let mut contents = Vec::new();
     t!(t!(File::open(stamp)).read_to_end(&mut contents));