Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce compile time of rustbuild #92297

Merged
merged 5 commits into from
Jan 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ dependencies = [
"filetime",
"getopts",
"ignore",
"lazy_static",
"libc",
"merge",
"num_cpus",
"once_cell",
"opener",
Expand Down Expand Up @@ -2221,28 +2219,6 @@ dependencies = [
"autocfg",
]

[[package]]
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"
version = "0.0.41"
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ 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"
merge = "0.1.0"
once_cell = "1.7.2"

[target.'cfg(windows)'.dependencies.winapi]
Expand Down
8 changes: 5 additions & 3 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -161,7 +163,7 @@ fn main() {
eprintln!(
"{} command: {:?}={:?} {:?}",
prefix,
bootstrap::util::dylib_path_var(),
dylib_path_var(),
env::join_paths(&dylib_path).unwrap(),
cmd,
);
Expand Down
8 changes: 5 additions & 3 deletions src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
Expand All @@ -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
Expand Down Expand Up @@ -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,
);
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ pub enum Kind {
Check,
Clippy,
Fix,
Format,
Test,
Bench,
Dist,
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 3 additions & 4 deletions src/bootstrap/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -222,9 +223,7 @@ impl Interner {
}
}

lazy_static! {
pub static ref INTERNER: Interner = Interner::default();
}
pub static INTERNER: Lazy<Interner> = 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,
Expand Down
Loading