From 2fe2728fa900a708d2c70342d9d6737e5462cf5d Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 26 Dec 2021 14:25:39 +0100 Subject: [PATCH 1/5] Remove the lazy_static dependency from rustbuild Rustbuild already depends on once_cell which in the future can be replaced with std::lazy::Lazy. --- Cargo.lock | 1 - src/bootstrap/Cargo.toml | 1 - src/bootstrap/cache.rs | 7 +++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 959c8161e984d..b714888370416 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -175,7 +175,6 @@ dependencies = [ "filetime", "getopts", "ignore", - "lazy_static", "libc", "merge", "num_cpus", diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 1ce1f0b26db58..9ad453497f691 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -44,7 +44,6 @@ libc = "0.2" serde = { version = "1.0.8", features = ["derive"] } serde_json = "1.0.2" toml = "0.5" -lazy_static = "1.3.0" time = "0.1" ignore = "0.4.10" opener = "0.5" diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index 0c16fae01bca7..fac5d8db5119d 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -13,7 +13,8 @@ use std::ops::Deref; use std::path::{Path, PathBuf}; use std::sync::Mutex; -use lazy_static::lazy_static; +// FIXME: replace with std::lazy after it gets stabilized and reaches beta +use once_cell::sync::Lazy; use crate::builder::Step; @@ -222,9 +223,7 @@ impl Interner { } } -lazy_static! { - pub static ref INTERNER: Interner = Interner::default(); -} +pub static INTERNER: Lazy = Lazy::new(Interner::default); /// This is essentially a `HashMap` which allows storing any type in its input and /// any type in its output. It is a write-once cache; values are never evicted, From 043745cb9688fbecd97638b2fa156cb055bbbb14 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 26 Dec 2021 15:05:12 +0100 Subject: [PATCH 2/5] Avoid the merge derive macro in rustbuild The task of the macro is simple enough that a decl macro is almost ten times shorter than the original proc macro. The proc macro is 159 lines while the decl macro is just 18 lines. This reduces the amount of dependencies of rustbuild from 45 to 37. It also slight reduces compilation time from 47s to 44s for debug builds. --- Cargo.lock | 16 -- src/bootstrap/Cargo.toml | 2 +- src/bootstrap/config.rs | 361 +++++++++++++++++++++------------------ 3 files changed, 197 insertions(+), 182 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b714888370416..dd4d48c126fdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2225,22 +2225,6 @@ name = "merge" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9" -dependencies = [ - "merge_derive", - "num-traits", -] - -[[package]] -name = "merge_derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209d075476da2e63b4b29e72a2ef627b840589588e71400a25e3565c4f849d07" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] [[package]] name = "minifier" diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 9ad453497f691..1f218dd8d67bc 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -47,7 +47,7 @@ toml = "0.5" time = "0.1" ignore = "0.4.10" opener = "0.5" -merge = "0.1.0" +merge = { version = "0.1.0", default-features = false, features = ["std"] } once_cell = "1.7.2" [target.'cfg(windows)'.dependencies.winapi] diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 7a4593a75f280..fcca783fbfe3e 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -357,105 +357,132 @@ impl Merge for TomlConfig { } } -/// TOML representation of various global build decisions. -#[derive(Deserialize, Default, Clone, Merge)] -#[serde(deny_unknown_fields, rename_all = "kebab-case")] -struct Build { - build: Option, - host: Option>, - target: Option>, - // This is ignored, the rust code always gets the build directory from the `BUILD_DIR` env variable - build_dir: Option, - cargo: Option, - rustc: Option, - rustfmt: Option, - docs: Option, - compiler_docs: Option, - docs_minification: Option, - submodules: Option, - fast_submodules: Option, - gdb: Option, - nodejs: Option, - npm: Option, - python: Option, - locked_deps: Option, - vendor: Option, - full_bootstrap: Option, - extended: Option, - tools: Option>, - verbose: Option, - sanitizers: Option, - profiler: Option, - cargo_native_static: Option, - low_priority: Option, - configure_args: Option>, - local_rebuild: Option, - print_step_timings: Option, - print_step_rusage: Option, - check_stage: Option, - doc_stage: Option, - build_stage: Option, - test_stage: Option, - install_stage: Option, - dist_stage: Option, - bench_stage: Option, - patch_binaries_for_nix: Option, +macro_rules! derive_merge { + ($(#[$attr:meta])* struct $name:ident { + $($field:ident: $field_ty:ty,)* + }) => { + $(#[$attr])* + struct $name { + $($field: $field_ty,)* + } + + impl Merge for $name { + fn merge(&mut self, other: Self) { + $( + Merge::merge(&mut self.$field, other.$field); + )* + } + } + } } -/// TOML representation of various global install decisions. -#[derive(Deserialize, Default, Clone, Merge)] -#[serde(deny_unknown_fields, rename_all = "kebab-case")] -struct Install { - prefix: Option, - sysconfdir: Option, - docdir: Option, - bindir: Option, - libdir: Option, - mandir: Option, - datadir: Option, +derive_merge! { + /// TOML representation of various global build decisions. + #[derive(Deserialize, Default, Clone)] + #[serde(deny_unknown_fields, rename_all = "kebab-case")] + struct Build { + build: Option, + host: Option>, + target: Option>, + // This is ignored, the rust code always gets the build directory from the `BUILD_DIR` env variable + build_dir: Option, + cargo: Option, + rustc: Option, + rustfmt: Option, + docs: Option, + compiler_docs: Option, + docs_minification: Option, + submodules: Option, + fast_submodules: Option, + gdb: Option, + nodejs: Option, + npm: Option, + python: Option, + locked_deps: Option, + vendor: Option, + full_bootstrap: Option, + extended: Option, + tools: Option>, + verbose: Option, + sanitizers: Option, + profiler: Option, + cargo_native_static: Option, + low_priority: Option, + configure_args: Option>, + local_rebuild: Option, + print_step_timings: Option, + print_step_rusage: Option, + check_stage: Option, + doc_stage: Option, + build_stage: Option, + test_stage: Option, + install_stage: Option, + dist_stage: Option, + bench_stage: Option, + patch_binaries_for_nix: Option, + } } -/// TOML representation of how the LLVM build is configured. -#[derive(Deserialize, Default, Merge)] -#[serde(deny_unknown_fields, rename_all = "kebab-case")] -struct Llvm { - skip_rebuild: Option, - optimize: Option, - thin_lto: Option, - release_debuginfo: Option, - assertions: Option, - tests: Option, - plugins: Option, - ccache: Option, - version_check: Option, - static_libstdcpp: Option, - ninja: Option, - targets: Option, - experimental_targets: Option, - link_jobs: Option, - link_shared: Option, - version_suffix: Option, - clang_cl: Option, - cflags: Option, - cxxflags: Option, - ldflags: Option, - use_libcxx: Option, - use_linker: Option, - allow_old_toolchain: Option, - polly: Option, - clang: Option, - download_ci_llvm: Option, +derive_merge! { + /// TOML representation of various global install decisions. + #[derive(Deserialize, Default, Clone)] + #[serde(deny_unknown_fields, rename_all = "kebab-case")] + struct Install { + prefix: Option, + sysconfdir: Option, + docdir: Option, + bindir: Option, + libdir: Option, + mandir: Option, + datadir: Option, + } } -#[derive(Deserialize, Default, Clone, Merge)] -#[serde(deny_unknown_fields, rename_all = "kebab-case")] -struct Dist { - sign_folder: Option, - gpg_password_file: Option, - upload_addr: Option, - src_tarball: Option, - missing_tools: Option, - compression_formats: Option>, +derive_merge! { + /// TOML representation of how the LLVM build is configured. + #[derive(Deserialize, Default)] + #[serde(deny_unknown_fields, rename_all = "kebab-case")] + struct Llvm { + skip_rebuild: Option, + optimize: Option, + thin_lto: Option, + release_debuginfo: Option, + assertions: Option, + tests: Option, + plugins: Option, + ccache: Option, + version_check: Option, + static_libstdcpp: Option, + ninja: Option, + targets: Option, + experimental_targets: Option, + link_jobs: Option, + link_shared: Option, + version_suffix: Option, + clang_cl: Option, + cflags: Option, + cxxflags: Option, + ldflags: Option, + use_libcxx: Option, + use_linker: Option, + allow_old_toolchain: Option, + polly: Option, + clang: Option, + download_ci_llvm: Option, + } +} + +derive_merge! { + #[derive(Deserialize, Default, Clone)] + #[serde(deny_unknown_fields, rename_all = "kebab-case")] + struct Dist { + sign_folder: Option, + gpg_password_file: Option, + upload_addr: Option, + src_tarball: Option, + missing_tools: Option, + compression_formats: Option>, + } } #[derive(Deserialize)] @@ -471,80 +498,84 @@ impl Default for StringOrBool { } } -/// TOML representation of how the Rust build is configured. -#[derive(Deserialize, Default, Merge)] -#[serde(deny_unknown_fields, rename_all = "kebab-case")] -struct Rust { - optimize: Option, - debug: Option, - codegen_units: Option, - codegen_units_std: Option, - debug_assertions: Option, - debug_assertions_std: Option, - overflow_checks: Option, - overflow_checks_std: Option, - debug_logging: Option, - debuginfo_level: Option, - debuginfo_level_rustc: Option, - debuginfo_level_std: Option, - debuginfo_level_tools: Option, - debuginfo_level_tests: Option, - run_dsymutil: Option, - backtrace: Option, - incremental: Option, - parallel_compiler: Option, - default_linker: Option, - channel: Option, - description: Option, - musl_root: Option, - rpath: Option, - verbose_tests: Option, - optimize_tests: Option, - codegen_tests: Option, - ignore_git: Option, - dist_src: Option, - save_toolstates: Option, - codegen_backends: Option>, - lld: Option, - use_lld: Option, - llvm_tools: Option, - deny_warnings: Option, - backtrace_on_ice: Option, - verify_llvm_ir: Option, - thin_lto_import_instr_limit: Option, - remap_debuginfo: Option, - jemalloc: Option, - test_compare_mode: Option, - llvm_libunwind: Option, - control_flow_guard: Option, - new_symbol_mangling: Option, - profile_generate: Option, - profile_use: Option, - // ignored; this is set from an env var set by bootstrap.py - download_rustc: Option, +derive_merge! { + /// TOML representation of how the Rust build is configured. + #[derive(Deserialize, Default)] + #[serde(deny_unknown_fields, rename_all = "kebab-case")] + struct Rust { + optimize: Option, + debug: Option, + codegen_units: Option, + codegen_units_std: Option, + debug_assertions: Option, + debug_assertions_std: Option, + overflow_checks: Option, + overflow_checks_std: Option, + debug_logging: Option, + debuginfo_level: Option, + debuginfo_level_rustc: Option, + debuginfo_level_std: Option, + debuginfo_level_tools: Option, + debuginfo_level_tests: Option, + run_dsymutil: Option, + backtrace: Option, + incremental: Option, + parallel_compiler: Option, + default_linker: Option, + channel: Option, + description: Option, + musl_root: Option, + rpath: Option, + verbose_tests: Option, + optimize_tests: Option, + codegen_tests: Option, + ignore_git: Option, + dist_src: Option, + save_toolstates: Option, + codegen_backends: Option>, + lld: Option, + use_lld: Option, + llvm_tools: Option, + deny_warnings: Option, + backtrace_on_ice: Option, + verify_llvm_ir: Option, + thin_lto_import_instr_limit: Option, + remap_debuginfo: Option, + jemalloc: Option, + test_compare_mode: Option, + llvm_libunwind: Option, + control_flow_guard: Option, + new_symbol_mangling: Option, + profile_generate: Option, + profile_use: Option, + // ignored; this is set from an env var set by bootstrap.py + download_rustc: Option, + } } -/// TOML representation of how each build target is configured. -#[derive(Deserialize, Default, Merge)] -#[serde(deny_unknown_fields, rename_all = "kebab-case")] -struct TomlTarget { - cc: Option, - cxx: Option, - ar: Option, - ranlib: Option, - default_linker: Option, - linker: Option, - llvm_config: Option, - llvm_filecheck: Option, - android_ndk: Option, - sanitizers: Option, - profiler: Option, - crt_static: Option, - musl_root: Option, - musl_libdir: Option, - wasi_root: Option, - qemu_rootfs: Option, - no_std: Option, +derive_merge! { + /// TOML representation of how each build target is configured. + #[derive(Deserialize, Default)] + #[serde(deny_unknown_fields, rename_all = "kebab-case")] + struct TomlTarget { + cc: Option, + cxx: Option, + ar: Option, + ranlib: Option, + default_linker: Option, + linker: Option, + llvm_config: Option, + llvm_filecheck: Option, + android_ndk: Option, + sanitizers: Option, + profiler: Option, + crt_static: Option, + musl_root: Option, + musl_libdir: Option, + wasi_root: Option, + qemu_rootfs: Option, + no_std: Option, + } } impl Config { From 947e9483e9684025faee9eaba56a0fbb200d26b8 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 26 Dec 2021 15:35:50 +0100 Subject: [PATCH 3/5] Make the rustc and rustdoc wrapper not depend on libbootstrap This slightly improves compilation time by reducing linking time (saving about a 1/10 of the the total compilation time after changing rustbuild) and slightly reduces disk usage (from 16MB for the rustc wrapper to 4MB). --- src/bootstrap/bin/rustc.rs | 8 +++++--- src/bootstrap/bin/rustdoc.rs | 8 +++++--- src/bootstrap/dylib_util.rs | 28 ++++++++++++++++++++++++++++ src/bootstrap/util.rs | 24 +----------------------- 4 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 src/bootstrap/dylib_util.rs diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index ed53a98e9a53f..7105a2457e282 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -15,6 +15,8 @@ //! switching compilers for the bootstrap and for build scripts will probably //! never get replaced. +include!("../dylib_util.rs"); + use std::env; use std::path::PathBuf; use std::process::{Child, Command}; @@ -50,11 +52,11 @@ fn main() { let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc)); let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir)); - let mut dylib_path = bootstrap::util::dylib_path(); + let mut dylib_path = dylib_path(); dylib_path.insert(0, PathBuf::from(&libdir)); let mut cmd = Command::new(rustc); - cmd.args(&args).env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap()); + cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); // Get the name of the crate we're compiling, if any. let crate_name = @@ -161,7 +163,7 @@ fn main() { eprintln!( "{} command: {:?}={:?} {:?}", prefix, - bootstrap::util::dylib_path_var(), + dylib_path_var(), env::join_paths(&dylib_path).unwrap(), cmd, ); diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index e4396d53016ea..ad3800834b07c 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -7,6 +7,8 @@ use std::ffi::OsString; use std::path::PathBuf; use std::process::Command; +include!("../dylib_util.rs"); + fn main() { let args = env::args_os().skip(1).collect::>(); let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set"); @@ -20,14 +22,14 @@ fn main() { Err(_) => 0, }; - let mut dylib_path = bootstrap::util::dylib_path(); + let mut dylib_path = dylib_path(); dylib_path.insert(0, PathBuf::from(libdir.clone())); let mut cmd = Command::new(rustdoc); cmd.args(&args) .arg("--sysroot") .arg(&sysroot) - .env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap()); + .env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); // Force all crates compiled by this compiler to (a) be unstable and (b) // allow the `rustc_private` feature to link to other unstable crates @@ -59,7 +61,7 @@ fn main() { if verbose > 1 { eprintln!( "rustdoc command: {:?}={:?} {:?}", - bootstrap::util::dylib_path_var(), + dylib_path_var(), env::join_paths(&dylib_path).unwrap(), cmd, ); diff --git a/src/bootstrap/dylib_util.rs b/src/bootstrap/dylib_util.rs new file mode 100644 index 0000000000000..6d75272c50130 --- /dev/null +++ b/src/bootstrap/dylib_util.rs @@ -0,0 +1,28 @@ +// Various utilities for working with dylib paths. +// +// This file is meant to be included directly to avoid a dependency on the bootstrap library from +// the rustc and rustdoc wrappers. This improves compilation time by reducing the linking time. + +/// Returns the environment variable which the dynamic library lookup path +/// resides in for this platform. +pub fn dylib_path_var() -> &'static str { + if cfg!(target_os = "windows") { + "PATH" + } else if cfg!(target_os = "macos") { + "DYLD_LIBRARY_PATH" + } else if cfg!(target_os = "haiku") { + "LIBRARY_PATH" + } else { + "LD_LIBRARY_PATH" + } +} + +/// Parses the `dylib_path_var()` environment variable, returning a list of +/// paths that are members of this lookup path. +pub fn dylib_path() -> Vec { + let var = match env::var_os(dylib_path_var()) { + Some(v) => v, + None => return vec![], + }; + env::split_paths(&var).collect() +} diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 57178aa382ffd..d0a4009138568 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -54,29 +54,7 @@ pub fn add_dylib_path(path: Vec, cmd: &mut Command) { cmd.env(dylib_path_var(), t!(env::join_paths(list))); } -/// Returns the environment variable which the dynamic library lookup path -/// resides in for this platform. -pub fn dylib_path_var() -> &'static str { - if cfg!(target_os = "windows") { - "PATH" - } else if cfg!(target_os = "macos") { - "DYLD_LIBRARY_PATH" - } else if cfg!(target_os = "haiku") { - "LIBRARY_PATH" - } else { - "LD_LIBRARY_PATH" - } -} - -/// Parses the `dylib_path_var()` environment variable, returning a list of -/// paths that are members of this lookup path. -pub fn dylib_path() -> Vec { - let var = match env::var_os(dylib_path_var()) { - Some(v) => v, - None => return vec![], - }; - env::split_paths(&var).collect() -} +include!("dylib_util.rs"); /// Adds a list of lookup paths to `cmd`'s link library lookup path. pub fn add_link_lib_path(path: Vec, cmd: &mut Command) { From ad6f98cd28e02d10323c125c8ad2eef44dbfbb20 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 1 Jan 2022 17:03:24 +0100 Subject: [PATCH 4/5] Remove the merge dependency --- Cargo.lock | 7 ------- src/bootstrap/Cargo.toml | 1 - src/bootstrap/config.rs | 11 +++++++++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd4d48c126fdf..a912eee97dbf2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,7 +176,6 @@ dependencies = [ "getopts", "ignore", "libc", - "merge", "num_cpus", "once_cell", "opener", @@ -2220,12 +2219,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "merge" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9" - [[package]] name = "minifier" version = "0.0.41" diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 1f218dd8d67bc..b68b2163f873a 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -47,7 +47,6 @@ toml = "0.5" time = "0.1" ignore = "0.4.10" opener = "0.5" -merge = { version = "0.1.0", default-features = false, features = ["std"] } once_cell = "1.7.2" [target.'cfg(windows)'.dependencies.winapi] diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index fcca783fbfe3e..c930657c5bd2f 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -18,7 +18,6 @@ pub use crate::flags::Subcommand; use crate::flags::{Color, Flags}; use crate::util::exe; use build_helper::t; -use merge::Merge; use serde::Deserialize; macro_rules! check_ci_llvm { @@ -334,6 +333,10 @@ struct TomlConfig { profile: Option, } +trait Merge { + fn merge(&mut self, other: Self); +} + impl Merge for TomlConfig { fn merge( &mut self, @@ -357,6 +360,8 @@ impl Merge for TomlConfig { } } +// We are using a decl macro instead of a derive proc macro here to reduce the compile time of +// rustbuild. macro_rules! derive_merge { ($(#[$attr:meta])* struct $name:ident { $($field:ident: $field_ty:ty,)* @@ -369,7 +374,9 @@ macro_rules! derive_merge { impl Merge for $name { fn merge(&mut self, other: Self) { $( - Merge::merge(&mut self.$field, other.$field); + if !self.$field.is_some() { + self.$field = other.$field; + } )* } } From 7ea6e713c21db0fb19e28a9071910776d13ed769 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 1 Jan 2022 18:50:56 +0100 Subject: [PATCH 5/5] Remove some dead code --- src/bootstrap/builder.rs | 3 +-- src/bootstrap/config.rs | 4 ---- src/bootstrap/lib.rs | 5 ----- src/bootstrap/util.rs | 20 -------------------- 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index bbd2c087ccabb..917abde9de1ce 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -351,7 +351,6 @@ pub enum Kind { Check, Clippy, Fix, - Format, Test, Bench, Dist, @@ -399,7 +398,7 @@ impl<'a> Builder<'a> { native::Lld, native::CrtBeginEnd ), - Kind::Check | Kind::Clippy { .. } | Kind::Fix | Kind::Format => describe!( + Kind::Check | Kind::Clippy { .. } | Kind::Fix => describe!( check::Std, check::Rustc, check::Rustdoc, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index c930657c5bd2f..5af9248583cae 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1149,10 +1149,6 @@ impl Config { self.verbose > 0 } - pub fn very_verbose(&self) -> bool { - self.verbose > 1 - } - pub fn sanitizers_enabled(&self, target: TargetSelection) -> bool { self.target_config.get(&target).map(|t| t.sanitizers).flatten().unwrap_or(self.sanitizers) } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 82462f9758e5c..8569089f70128 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -110,7 +110,6 @@ use std::fs::{self, File, OpenOptions}; use std::io::{Read, Seek, SeekFrom, Write}; use std::path::{Path, PathBuf}; use std::process::{self, Command}; -use std::slice; use std::str; #[cfg(unix)] @@ -472,10 +471,6 @@ impl Build { build } - pub fn build_triple(&self) -> &[Interned] { - slice::from_ref(&self.build.triple) - } - // modified from `check_submodule` and `update_submodule` in bootstrap.py /// Given a path to the directory of a submodule, update it. /// diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index d0a4009138568..ee58bedcc8735 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -16,11 +16,6 @@ use build_helper::t; use crate::builder::Builder; use crate::config::{Config, TargetSelection}; -/// Returns the `name` as the filename of a static library for `target`. -pub fn staticlib(name: &str, target: TargetSelection) -> String { - if target.contains("windows") { format!("{}.lib", name) } else { format!("lib{}.a", name) } -} - /// Given an executable called `name`, return the filename for the /// executable for a particular target. pub fn exe(name: &str, target: TargetSelection) -> String { @@ -81,21 +76,6 @@ fn link_lib_path() -> Vec { env::split_paths(&var).collect() } -/// `push` all components to `buf`. On windows, append `.exe` to the last component. -pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf { - let (&file, components) = components.split_last().expect("at least one component required"); - let mut file = file.to_owned(); - - if cfg!(windows) { - file.push_str(".exe"); - } - - buf.extend(components); - buf.push(file); - - buf -} - pub struct TimeIt(bool, Instant); /// Returns an RAII structure that prints out how long it took to drop.