Skip to content

Commit ab7a356

Browse files
authored
Rollup merge of #92297 - bjorn3:smaller_bootstrap, r=Mark-Simulacrum
Reduce compile time of rustbuild Best reviewed commit by commit. The `ignore` crate and it's dependencies are probably responsible for the majority of the compile time after this PR. cc `@jyn514` as you got a couple of open rustbuild PR.
2 parents 5137f7c + 7ea6e71 commit ab7a356

File tree

10 files changed

+247
-256
lines changed

10 files changed

+247
-256
lines changed

Cargo.lock

-24
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ dependencies = [
175175
"filetime",
176176
"getopts",
177177
"ignore",
178-
"lazy_static",
179178
"libc",
180-
"merge",
181179
"num_cpus",
182180
"once_cell",
183181
"opener",
@@ -2221,28 +2219,6 @@ dependencies = [
22212219
"autocfg",
22222220
]
22232221

2224-
[[package]]
2225-
name = "merge"
2226-
version = "0.1.0"
2227-
source = "registry+https://github.com/rust-lang/crates.io-index"
2228-
checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9"
2229-
dependencies = [
2230-
"merge_derive",
2231-
"num-traits",
2232-
]
2233-
2234-
[[package]]
2235-
name = "merge_derive"
2236-
version = "0.1.0"
2237-
source = "registry+https://github.com/rust-lang/crates.io-index"
2238-
checksum = "209d075476da2e63b4b29e72a2ef627b840589588e71400a25e3565c4f849d07"
2239-
dependencies = [
2240-
"proc-macro-error",
2241-
"proc-macro2",
2242-
"quote",
2243-
"syn",
2244-
]
2245-
22462222
[[package]]
22472223
name = "minifier"
22482224
version = "0.0.41"

src/bootstrap/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ libc = "0.2"
4444
serde = { version = "1.0.8", features = ["derive"] }
4545
serde_json = "1.0.2"
4646
toml = "0.5"
47-
lazy_static = "1.3.0"
4847
time = "0.1"
4948
ignore = "0.4.10"
5049
opener = "0.5"
51-
merge = "0.1.0"
5250
once_cell = "1.7.2"
5351

5452
[target.'cfg(windows)'.dependencies.winapi]

src/bootstrap/bin/rustc.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
//! switching compilers for the bootstrap and for build scripts will probably
1616
//! never get replaced.
1717
18+
include!("../dylib_util.rs");
19+
1820
use std::env;
1921
use std::path::PathBuf;
2022
use std::process::{Child, Command};
@@ -50,11 +52,11 @@ fn main() {
5052

5153
let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
5254
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
53-
let mut dylib_path = bootstrap::util::dylib_path();
55+
let mut dylib_path = dylib_path();
5456
dylib_path.insert(0, PathBuf::from(&libdir));
5557

5658
let mut cmd = Command::new(rustc);
57-
cmd.args(&args).env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
59+
cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
5860

5961
// Get the name of the crate we're compiling, if any.
6062
let crate_name =
@@ -161,7 +163,7 @@ fn main() {
161163
eprintln!(
162164
"{} command: {:?}={:?} {:?}",
163165
prefix,
164-
bootstrap::util::dylib_path_var(),
166+
dylib_path_var(),
165167
env::join_paths(&dylib_path).unwrap(),
166168
cmd,
167169
);

src/bootstrap/bin/rustdoc.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use std::ffi::OsString;
77
use std::path::PathBuf;
88
use std::process::Command;
99

10+
include!("../dylib_util.rs");
11+
1012
fn main() {
1113
let args = env::args_os().skip(1).collect::<Vec<_>>();
1214
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
@@ -20,14 +22,14 @@ fn main() {
2022
Err(_) => 0,
2123
};
2224

23-
let mut dylib_path = bootstrap::util::dylib_path();
25+
let mut dylib_path = dylib_path();
2426
dylib_path.insert(0, PathBuf::from(libdir.clone()));
2527

2628
let mut cmd = Command::new(rustdoc);
2729
cmd.args(&args)
2830
.arg("--sysroot")
2931
.arg(&sysroot)
30-
.env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
32+
.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
3133

3234
// Force all crates compiled by this compiler to (a) be unstable and (b)
3335
// allow the `rustc_private` feature to link to other unstable crates
@@ -59,7 +61,7 @@ fn main() {
5961
if verbose > 1 {
6062
eprintln!(
6163
"rustdoc command: {:?}={:?} {:?}",
62-
bootstrap::util::dylib_path_var(),
64+
dylib_path_var(),
6365
env::join_paths(&dylib_path).unwrap(),
6466
cmd,
6567
);

src/bootstrap/builder.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ pub enum Kind {
351351
Check,
352352
Clippy,
353353
Fix,
354-
Format,
355354
Test,
356355
Bench,
357356
Dist,
@@ -399,7 +398,7 @@ impl<'a> Builder<'a> {
399398
native::Lld,
400399
native::CrtBeginEnd
401400
),
402-
Kind::Check | Kind::Clippy { .. } | Kind::Fix | Kind::Format => describe!(
401+
Kind::Check | Kind::Clippy { .. } | Kind::Fix => describe!(
403402
check::Std,
404403
check::Rustc,
405404
check::Rustdoc,

src/bootstrap/cache.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ use std::ops::Deref;
1313
use std::path::{Path, PathBuf};
1414
use std::sync::Mutex;
1515

16-
use lazy_static::lazy_static;
16+
// FIXME: replace with std::lazy after it gets stabilized and reaches beta
17+
use once_cell::sync::Lazy;
1718

1819
use crate::builder::Step;
1920

@@ -222,9 +223,7 @@ impl Interner {
222223
}
223224
}
224225

225-
lazy_static! {
226-
pub static ref INTERNER: Interner = Interner::default();
227-
}
226+
pub static INTERNER: Lazy<Interner> = Lazy::new(Interner::default);
228227

229228
/// This is essentially a `HashMap` which allows storing any type in its input and
230229
/// any type in its output. It is a write-once cache; values are never evicted,

0 commit comments

Comments
 (0)