Skip to content

Commit f4620a3

Browse files
Stub out less code
1 parent 42fde21 commit f4620a3

File tree

6 files changed

+17
-25
lines changed

6 files changed

+17
-25
lines changed

src/bootstrap/builder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ impl<'a> Builder<'a> {
691691
// the options through environment variables that are fetched and understood by both.
692692
//
693693
// FIXME: the guard against msvc shouldn't need to be here
694-
if !target.contains("msvc") && !cfg!(test) {
694+
if !target.contains("msvc") {
695695
let ccache = self.config.ccache.as_ref();
696696
let ccacheify = |s: &Path| {
697697
let ccache = match ccache {
@@ -874,6 +874,8 @@ mod __test {
874874

875875
fn configure(host: &[&str], target: &[&str]) -> Config {
876876
let mut config = Config::default_opts();
877+
// don't save toolstates
878+
config.save_toolstates = None;
877879
config.run_host_only = true;
878880
config.build = INTERNER.intern_str("A");
879881
config.hosts = vec![config.build].clone().into_iter()

src/bootstrap/compile.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ impl Step for CodegenBackend {
722722
fn copy_codegen_backends_to_sysroot(builder: &Builder,
723723
compiler: Compiler,
724724
target_compiler: Compiler) {
725-
if cfg!(test) { return; }
726725
let build = builder.build;
727726
let target = target_compiler.host;
728727

src/bootstrap/doc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ impl Step for UnstableBookGen {
817817
}
818818

819819
fn symlink_dir_force(src: &Path, dst: &Path) -> io::Result<()> {
820-
if cfg!(test) { return Ok(()); }
821820
if let Ok(m) = fs::symlink_metadata(dst) {
822821
if m.file_type().is_dir() {
823822
try!(fs::remove_dir_all(dst));

src/bootstrap/lib.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -367,20 +367,20 @@ impl Build {
367367
cc_detect::find(&mut build);
368368
build.verbose("running sanity check");
369369
sanity::check(&mut build);
370-
if !cfg!(test) {
371-
// If local-rust is the same major.minor as the current version, then force a
372-
// local-rebuild
373-
let local_version_verbose = output(
374-
Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
375-
let local_release = local_version_verbose
376-
.lines().filter(|x| x.starts_with("release:"))
377-
.next().unwrap().trim_left_matches("release:").trim();
378-
let my_version = channel::CFG_RELEASE_NUM;
379-
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
380-
build.verbose(&format!("auto-detected local-rebuild {}", local_release));
381-
build.local_rebuild = true;
382-
}
370+
371+
// If local-rust is the same major.minor as the current version, then force a
372+
// local-rebuild
373+
let local_version_verbose = output(
374+
Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
375+
let local_release = local_version_verbose
376+
.lines().filter(|x| x.starts_with("release:"))
377+
.next().unwrap().trim_left_matches("release:").trim();
378+
let my_version = channel::CFG_RELEASE_NUM;
379+
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
380+
build.verbose(&format!("auto-detected local-rebuild {}", local_release));
381+
build.local_rebuild = true;
383382
}
383+
384384
build.verbose("learning about cargo");
385385
metadata::build(&mut build);
386386

@@ -426,7 +426,6 @@ impl Build {
426426
///
427427
/// After this executes, it will also ensure that `dir` exists.
428428
fn clear_if_dirty(&self, dir: &Path, input: &Path) -> bool {
429-
if cfg!(test) { return true; }
430429
let stamp = dir.join(".stamp");
431430
let mut cleared = false;
432431
if mtime(&stamp) < mtime(input) {
@@ -697,7 +696,6 @@ impl Build {
697696

698697
/// Returns the path to the linker for the given target if it needs to be overridden.
699698
fn linker(&self, target: Interned<String>) -> Option<&Path> {
700-
if cfg!(test) { return None; }
701699
if let Some(linker) = self.config.target_config.get(&target)
702700
.and_then(|c| c.linker.as_ref()) {
703701
Some(linker)

src/bootstrap/tool.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ impl Step for ToolBuild {
199199

200200
if !is_expected {
201201
if !is_ext_tool {
202-
if cfg!(test) {
203-
panic!("unexpected failure -- would have hard exited");
204-
} else {
205-
exit(1);
206-
}
202+
exit(1);
207203
} else {
208204
return None;
209205
}

src/bootstrap/util.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub fn staticlib(name: &str, target: &str) -> String {
3434

3535
/// Copies a file from `src` to `dst`
3636
pub fn copy(src: &Path, dst: &Path) {
37-
if cfg!(test) { return; }
3837
let _ = fs::remove_file(&dst);
3938
// Attempt to "easy copy" by creating a hard link (symlinks don't work on
4039
// 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)]) {
6766
}
6867

6968
pub fn read_stamp_file(stamp: &Path) -> Vec<PathBuf> {
70-
if cfg!(test) { return vec![]; }
7169
let mut paths = Vec::new();
7270
let mut contents = Vec::new();
7371
t!(t!(File::open(stamp)).read_to_end(&mut contents));

0 commit comments

Comments
 (0)