diff options
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 13 | ||||
| -rw-r--r-- | src/bootstrap/bootstrap.py | 14 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 54 | ||||
| -rw-r--r-- | src/bootstrap/cache.rs | 25 | ||||
| -rw-r--r-- | src/bootstrap/channel.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/check.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 30 | ||||
| -rw-r--r-- | src/bootstrap/config.rs | 33 | ||||
| -rwxr-xr-x | src/bootstrap/configure.py | 23 | ||||
| -rw-r--r-- | src/bootstrap/dist.rs | 18 | ||||
| -rw-r--r-- | src/bootstrap/doc.rs | 36 | ||||
| -rw-r--r-- | src/bootstrap/flags.rs | 19 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 44 | ||||
| -rw-r--r-- | src/bootstrap/mk/Makefile.in | 7 | ||||
| -rw-r--r-- | src/bootstrap/native.rs | 190 | ||||
| -rw-r--r-- | src/bootstrap/sanity.rs | 8 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 51 | ||||
| -rw-r--r-- | src/bootstrap/tool.rs | 33 | 
18 files changed, 211 insertions, 392 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index b6764c1aaea..afe1b4c42ea 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -232,7 +232,9 @@ fn main() { // flesh out rpath support more fully in the future. cmd.arg("-Z").arg("osx-rpath-install-name"); Some("-Wl,-rpath,@loader_path/../lib") - } else if !target.contains("windows") && !target.contains("wasm32") { + } else if !target.contains("windows") && + !target.contains("wasm32") && + !target.contains("fuchsia") { Some("-Wl,-rpath,$ORIGIN/../lib") } else { None @@ -253,8 +255,15 @@ fn main() { // When running miri tests, we need to generate MIR for all libraries if env::var("TEST_MIRI").ok().map_or(false, |val| val == "true") { + // The flags here should be kept in sync with `add_miri_default_args` + // in miri's `src/lib.rs`. cmd.arg("-Zalways-encode-mir"); - cmd.arg("-Zmir-emit-validate=1"); + // These options are preferred by miri, to be able to perform better validation, + // but the bootstrap compiler might not understand them. + if stage != "0" { + cmd.arg("-Zmir-emit-retag"); + cmd.arg("-Zmir-opt-level=0"); + } } // Force all crates compiled by this compiler to (a) be unstable and (b) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index c27f4f056d7..cd48e6aa4c4 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -79,8 +79,8 @@ def _download(path, url, probably_big, verbose, exception): # see http://serverfault.com/questions/301128/how-to-download if sys.platform == 'win32': run(["PowerShell.exe", "/nologo", "-Command", - "(New-Object System.Net.WebClient)" - ".DownloadFile('{}', '{}')".format(url, path)], + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;", + "(New-Object System.Net.WebClient).DownloadFile('{}', '{}')".format(url, path)], verbose=verbose, exception=exception) else: @@ -594,7 +594,7 @@ class RustBuild(object): return '' def bootstrap_binary(self): - """Return the path of the boostrap binary + """Return the path of the bootstrap binary >>> rb = RustBuild() >>> rb.build_dir = "build" @@ -632,6 +632,9 @@ class RustBuild(object): target_features += ["-crt-static"] if target_features: env["RUSTFLAGS"] += "-C target-feature=" + (",".join(target_features)) + " " + target_linker = self.get_toml("linker", build_section) + if target_linker is not None: + env["RUSTFLAGS"] += "-C linker=" + target_linker + " " env["PATH"] = os.path.join(self.bin_root(), "bin") + \ os.pathsep + env["PATH"] @@ -712,11 +715,6 @@ class RustBuild(object): backends = self.get_toml('codegen-backends') if backends is None or not 'emscripten' in backends: continue - if module.endswith("jemalloc"): - if self.get_toml('use-jemalloc') == 'false': - continue - if self.get_toml('jemalloc'): - continue if module.endswith("lld"): config = self.get_toml('lld') if config is None or config == 'false': diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index aa4e44df2ef..900f336ef8c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -130,7 +130,7 @@ impl PathSet { fn has(&self, needle: &Path) -> bool { match self { PathSet::Set(set) => set.iter().any(|p| p.ends_with(needle)), - PathSet::Suite(_) => false, + PathSet::Suite(suite) => suite.ends_with(needle), } } @@ -379,7 +379,6 @@ impl<'a> Builder<'a> { test::Ui, test::RunPass, test::CompileFail, - test::ParseFail, test::RunFail, test::RunPassValgrind, test::MirOpt, @@ -714,7 +713,7 @@ impl<'a> Builder<'a> { "build" => self.cargo_out(compiler, mode, target), // This is the intended out directory for crate documentation. - "doc" => self.crate_doc_out(target), + "doc" | "rustdoc" => self.crate_doc_out(target), _ => self.stage_out(compiler, mode), }; @@ -743,7 +742,7 @@ impl<'a> Builder<'a> { _ => compile::librustc_stamp(self, cmp, target), }; - if cmd == "doc" { + if cmd == "doc" || cmd == "rustdoc" { if mode == Mode::Rustc || mode == Mode::ToolRustc || mode == Mode::Codegen { // This is the intended out directory for compiler documentation. my_out = self.compiler_doc_out(target); @@ -883,7 +882,7 @@ impl<'a> Builder<'a> { .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) .env( "RUSTDOC_REAL", - if cmd == "doc" || (cmd == "test" && want_rustdoc) { + if cmd == "doc" || cmd == "rustdoc" || (cmd == "test" && want_rustdoc) { self.rustdoc(compiler.host) } else { PathBuf::from("/path/to/nowhere/rustdoc/not/required") @@ -1120,10 +1119,15 @@ impl<'a> Builder<'a> { cargo.arg("-v"); } - // This must be kept before the thinlto check, as we set codegen units - // to 1 forcibly there. - if let Some(n) = self.config.rust_codegen_units { - cargo.env("RUSTC_CODEGEN_UNITS", n.to_string()); + match (mode, self.config.rust_codegen_units_std, self.config.rust_codegen_units) { + (Mode::Std, Some(n), _) | + (Mode::Test, Some(n), _) | + (_, _, Some(n)) => { + cargo.env("RUSTC_CODEGEN_UNITS", n.to_string()); + } + _ => { + // Don't set anything + } } if self.config.rust_optimize { @@ -1845,7 +1849,7 @@ mod __test { ); // Ensure we don't build any compiler artifacts. - assert!(builder.cache.all::<compile::Rustc>().is_empty()); + assert!(!builder.cache.contains::<compile::Rustc>()); assert_eq!( first(builder.cache.all::<test::Crate>()), &[test::Crate { @@ -1857,4 +1861,34 @@ mod __test { },] ); } + + #[test] + fn test_exclude() { + let mut config = configure(&[], &[]); + config.exclude = vec![ + "src/test/run-pass".into(), + "src/tools/tidy".into(), + ]; + config.cmd = Subcommand::Test { + paths: Vec::new(), + test_args: Vec::new(), + rustc_args: Vec::new(), + fail_fast: true, + doc_tests: DocTests::No, + bless: false, + compare_mode: None, + }; + + let build = Build::new(config); + let builder = Builder::new(&build); + builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]); + + // Ensure we have really excluded run-pass & tidy + assert!(!builder.cache.contains::<test::RunPass>()); + assert!(!builder.cache.contains::<test::Tidy>()); + + // Ensure other tests are not affected. + assert!(builder.cache.contains::<test::RunPassFullDeps>()); + assert!(builder.cache.contains::<test::RustdocUi>()); + } } diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index bca5ff85ba2..0b561a3523f 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -169,19 +169,21 @@ impl Ord for Interned<String> { } } -struct TyIntern<T> { +struct TyIntern<T: Hash + Clone + Eq> { items: Vec<T>, set: HashMap<T, Interned<T>>, } -impl<T: Hash + Clone + Eq> TyIntern<T> { - fn new() -> TyIntern<T> { +impl<T: Hash + Clone + Eq> Default for TyIntern<T> { + fn default() -> Self { TyIntern { items: Vec::new(), - set: HashMap::new(), + set: Default::default(), } } +} +impl<T: Hash + Clone + Eq> TyIntern<T> { fn intern_borrow<B>(&mut self, item: &B) -> Interned<T> where B: Eq + Hash + ToOwned<Owned=T> + ?Sized, @@ -212,19 +214,13 @@ impl<T: Hash + Clone + Eq> TyIntern<T> { } } +#[derive(Default)] pub struct Interner { strs: Mutex<TyIntern<String>>, paths: Mutex<TyIntern<PathBuf>>, } impl Interner { - fn new() -> Interner { - Interner { - strs: Mutex::new(TyIntern::new()), - paths: Mutex::new(TyIntern::new()), - } - } - pub fn intern_str(&self, s: &str) -> Interned<String> { self.strs.lock().unwrap().intern_borrow(s) } @@ -238,7 +234,7 @@ impl Interner { } lazy_static! { - pub static ref INTERNER: Interner = Interner::new(); + pub static ref INTERNER: Interner = Interner::default(); } /// This is essentially a HashMap which allows storing any type in its input and @@ -290,4 +286,9 @@ impl Cache { v.sort_by_key(|&(a, _)| a); v } + + #[cfg(test)] + pub fn contains<S: Step>(&self) -> bool { + self.0.borrow().contains_key(&TypeId::of::<S>()) + } } diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 91bec69cfa4..88b6925b2b1 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -24,7 +24,7 @@ use Build; use config::Config; // The version number -pub const CFG_RELEASE_NUM: &str = "1.31.0"; +pub const CFG_RELEASE_NUM: &str = "1.32.0"; pub struct GitInfo { inner: Option<Info>, diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 11463c1a056..0c6dbb06bb8 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -224,7 +224,8 @@ impl Step for Rustdoc { target, "check", "src/tools/rustdoc", - SourceType::InTree); + SourceType::InTree, + &[]); let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage)); println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 69d45acdeda..c8689f78140 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -69,7 +69,7 @@ impl Step for Std { if builder.config.keep_stage.contains(&compiler.stage) { builder.info("Warning: Using a potentially old libstd. This may not behave well."); builder.ensure(StdLink { - compiler: compiler, + compiler, target_compiler: compiler, target, }); @@ -158,16 +158,7 @@ pub fn std_cargo(builder: &Builder, .arg("--manifest-path") .arg(builder.src.join("src/rustc/compiler_builtins_shim/Cargo.toml")); } else { - let mut features = builder.std_features(); - - // When doing a local rebuild we tell cargo that we're stage1 rather than - // stage0. This works fine if the local rust and being-built rust have the - // same view of what the default allocator is, but fails otherwise. Since - // we don't have a way to express an allocator preference yet, work - // around the issue in the case of a local rebuild with jemalloc disabled. - if compiler.stage == 0 && builder.local_rebuild && !builder.config.use_jemalloc { - features.push_str(" force_alloc_system"); - } + let features = builder.std_features(); if compiler.stage != 0 && builder.config.sanitizers { // This variable is used by the sanitizer runtime crates, e.g. @@ -188,11 +179,6 @@ pub fn std_cargo(builder: &Builder, .arg("--manifest-path") .arg(builder.src.join("src/libstd/Cargo.toml")); - if let Some(target) = builder.config.target_config.get(&target) { - if let Some(ref jemalloc) = target.jemalloc { - cargo.env("JEMALLOC_OVERRIDE", jemalloc); - } - } if target.contains("musl") { if let Some(p) = builder.musl_root(target) { cargo.env("MUSL_ROOT", p); @@ -217,7 +203,7 @@ impl Step for StdLink { /// Link all libstd rlibs/dylibs into the sysroot location. /// - /// Links those artifacts generated by `compiler` to a the `stage` compiler's + /// Links those artifacts generated by `compiler` to the `stage` compiler's /// sysroot for the specified `host` and `target`. /// /// Note that this assumes that `compiler` has already generated the libstd @@ -358,7 +344,7 @@ impl Step for Test { if builder.config.keep_stage.contains(&compiler.stage) { builder.info("Warning: Using a potentially old libtest. This may not behave well."); builder.ensure(TestLink { - compiler: compiler, + compiler, target_compiler: compiler, target, }); @@ -480,7 +466,7 @@ impl Step for Rustc { if builder.config.keep_stage.contains(&compiler.stage) { builder.info("Warning: Using a potentially old librustc. This may not behave well."); builder.ensure(RustcLink { - compiler: compiler, + compiler, target_compiler: compiler, target, }); @@ -750,7 +736,7 @@ pub fn build_codegen_backend(builder: &Builder, // Pass down configuration from the LLVM build into the build of // librustc_llvm and librustc_codegen_llvm. - if builder.is_rust_llvm(target) { + if builder.is_rust_llvm(target) && backend != "emscripten" { cargo.env("LLVM_RUSTLLVM", "1"); } cargo.env("LLVM_CONFIG", &llvm_config); @@ -816,8 +802,8 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder, let filename = file.file_name().unwrap().to_str().unwrap(); // change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so` let target_filename = { - let dash = filename.find("-").unwrap(); - let dot = filename.find(".").unwrap(); + let dash = filename.find('-').unwrap(); + let dot = filename.find('.').unwrap(); format!("{}-{}{}", &filename[..dash], backend, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index a5ed096a735..0f249eee000 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -95,6 +95,7 @@ pub struct Config { // rust codegen options pub rust_optimize: bool, pub rust_codegen_units: Option<u32>, + pub rust_codegen_units_std: Option<u32>, pub rust_debug_assertions: bool, pub rust_debuginfo: bool, pub rust_debuginfo_lines: bool, @@ -115,6 +116,7 @@ pub struct Config { pub hosts: Vec<Interned<String>>, pub targets: Vec<Interned<String>>, pub local_rebuild: bool, + pub jemalloc: bool, // dist misc pub dist_sign_folder: Option<PathBuf>, @@ -122,8 +124,6 @@ pub struct Config { pub dist_gpg_password_file: Option<PathBuf>, // libstd features - pub debug_jemalloc: bool, - pub use_jemalloc: bool, pub backtrace: bool, // support for RUST_BACKTRACE pub wasm_syscall: bool, @@ -149,7 +149,7 @@ pub struct Config { pub nodejs: Option<PathBuf>, pub gdb: Option<PathBuf>, pub python: Option<PathBuf>, - pub openssl_static: bool, + pub cargo_native_static: bool, pub configure_args: Vec<String>, // These are either the stage0 downloaded binaries or the locally installed ones. @@ -165,7 +165,6 @@ pub struct Target { pub llvm_config: Option<PathBuf>, /// Some(path to FileCheck) if one was specified. pub llvm_filecheck: Option<PathBuf>, - pub jemalloc: Option<PathBuf>, pub cc: Option<PathBuf>, pub cxx: Option<PathBuf>, pub ar: Option<PathBuf>, @@ -221,7 +220,7 @@ struct Build { verbose: Option<usize>, sanitizers: Option<bool>, profiler: Option<bool>, - openssl_static: Option<bool>, + cargo_native_static: Option<bool>, configure_args: Option<Vec<String>>, local_rebuild: Option<bool>, print_step_timings: Option<bool>, @@ -262,7 +261,7 @@ struct Llvm { link_jobs: Option<u32>, link_shared: Option<bool>, version_suffix: Option<String>, - clang_cl: Option<String> + clang_cl: Option<String>, } #[derive(Deserialize, Default, Clone)] @@ -294,14 +293,13 @@ impl Default for StringOrBool { struct Rust { optimize: Option<bool>, codegen_units: Option<u32>, + codegen_units_std: Option<u32>, debug_assertions: Option<bool>, debuginfo: Option<bool>, debuginfo_lines: Option<bool>, debuginfo_only_std: Option<bool>, debuginfo_tools: Option<bool>, experimental_parallel_queries: Option<bool>, - debug_jemalloc: Option<bool>, - use_jemalloc: Option<bool>, backtrace: Option<bool>, default_linker: Option<String>, channel: Option<String>, @@ -327,6 +325,7 @@ struct Rust { backtrace_on_ice: Option<bool>, verify_llvm_ir: Option<bool>, remap_debuginfo: Option<bool>, + jemalloc: Option<bool>, } /// TOML representation of how each build target is configured. @@ -335,7 +334,6 @@ struct Rust { struct TomlTarget { llvm_config: Option<String>, llvm_filecheck: Option<String>, - jemalloc: Option<String>, cc: Option<String>, cxx: Option<String>, ar: Option<String>, @@ -361,7 +359,6 @@ impl Config { config.llvm_enabled = true; config.llvm_optimize = true; config.llvm_version_check = true; - config.use_jemalloc = true; config.backtrace = true; config.rust_optimize = true; config.rust_optimize_tests = true; @@ -430,7 +427,7 @@ impl Config { } }).unwrap_or_else(|| TomlConfig::default()); - let build = toml.build.clone().unwrap_or(Build::default()); + let build = toml.build.clone().unwrap_or_default(); // set by bootstrap.py config.hosts.push(config.build.clone()); for host in build.host.iter() { @@ -474,7 +471,7 @@ impl Config { set(&mut config.verbose, build.verbose); set(&mut config.sanitizers, build.sanitizers); set(&mut config.profiler, build.profiler); - set(&mut config.openssl_static, build.openssl_static); + set(&mut config.cargo_native_static, build.cargo_native_static); set(&mut config.configure_args, build.configure_args); set(&mut config.local_rebuild, build.local_rebuild); set(&mut config.print_step_timings, build.print_step_timings); @@ -497,7 +494,6 @@ impl Config { let mut debuginfo_only_std = None; let mut debuginfo_tools = None; let mut debug = None; - let mut debug_jemalloc = None; let mut debuginfo = None; let mut debug_assertions = None; let mut optimize = None; @@ -524,7 +520,7 @@ impl Config { set(&mut config.llvm_link_shared, llvm.link_shared); config.llvm_targets = llvm.targets.clone(); config.llvm_experimental_targets = llvm.experimental_targets.clone() - .unwrap_or("WebAssembly;RISCV".to_string()); + .unwrap_or_else(|| "WebAssembly;RISCV".to_string()); config.llvm_link_jobs = llvm.link_jobs; config.llvm_version_suffix = llvm.version_suffix.clone(); config.llvm_clang_cl = llvm.clang_cl.clone(); @@ -539,12 +535,11 @@ impl Config { debuginfo_tools = rust.debuginfo_tools; optimize = rust.optimize; ignore_git = rust.ignore_git; - debug_jemalloc = rust.debug_jemalloc; set(&mut config.rust_optimize_tests, rust.optimize_tests); set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests); set(&mut config.codegen_tests, rust.codegen_tests); set(&mut config.rust_rpath, rust.rpath); - set(&mut config.use_jemalloc, rust.use_jemalloc); + set(&mut config.jemalloc, rust.jemalloc); set(&mut config.backtrace, rust.backtrace); set(&mut config.channel, rust.channel.clone()); set(&mut config.rust_dist_src, rust.dist_src); @@ -580,6 +575,8 @@ impl Config { Some(n) => config.rust_codegen_units = Some(n), None => {} } + + config.rust_codegen_units_std = rust.codegen_units_std; } if let Some(ref t) = toml.target { @@ -592,9 +589,6 @@ impl Config { if let Some(ref s) = cfg.llvm_filecheck { target.llvm_filecheck = Some(config.src.join(s)); } - if let Some(ref s) = cfg.jemalloc { - target.jemalloc = Some(config.src.join(s)); - } if let Some(ref s) = cfg.android_ndk { target.ndk = Some(config.src.join(s)); } @@ -640,7 +634,6 @@ impl Config { config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false); let default = debug == Some(true); - config.debug_jemalloc = debug_jemalloc.unwrap_or(default); config.rust_debuginfo = debuginfo.unwrap_or(default); config.rust_debug_assertions = debug_assertions.unwrap_or(default); diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index d95603190d8..5467c9f9d5b 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -40,7 +40,7 @@ def v(*args): options.append(Option(*args, value=True)) -o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given") +o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code (use `--disable-optimize` for that)") o("docs", "build.docs", "build standard library documentation") o("compiler-docs", "build.compiler-docs", "build compiler documentation") o("optimize-tests", "rust.optimize-tests", "build tests with optimizations") @@ -64,10 +64,11 @@ o("locked-deps", "build.locked-deps", "force Cargo.lock to be up to date") o("vendor", "build.vendor", "enable usage of vendored Rust crates") o("sanitizers", "build.sanitizers", "build the sanitizer runtimes (asan, lsan, msan, tsan)") o("dist-src", "rust.dist-src", "when building tarballs enables building a source tarball") -o("cargo-openssl-static", "build.openssl-static", "static openssl in cargo") +o("cargo-native-static", "build.cargo-native-static", "static native libraries in cargo") o("profiler", "build.profiler", "build the profiler runtime") o("emscripten", None, "compile the emscripten backend as well as LLVM") o("full-tools", None, "enable all tools") +o("lld", "rust.lld", "build lld") o("lldb", "rust.lldb", "build lldb") o("missing-tools", "dist.missing-tools", "allow failures when building tools") @@ -82,7 +83,6 @@ o("debuginfo", "rust.debuginfo", "build with debugger metadata") o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata") o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information") o("debuginfo-tools", "rust.debuginfo-tools", "build extended tools with debugging information") -o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill") v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file") v("prefix", "install.prefix", "set installation prefix") @@ -99,7 +99,6 @@ v("llvm-root", None, "set LLVM root") v("llvm-config", None, "set path to llvm-config") v("llvm-filecheck", None, "set path to LLVM's FileCheck utility") v("python", "build.python", "set path to python") -v("jemalloc-root", None, "set directory where libjemalloc_pic.a is located") v("android-cross-path", "target.arm-linux-androideabi.android-ndk", "Android NDK standalone path (deprecated)") v("i686-linux-android-ndk", "target.i686-linux-android.android-ndk", @@ -148,7 +147,6 @@ v("default-linker", "rust.default-linker", "the default linker") # Many of these are saved below during the "writing configuration" step # (others are conditionally saved). o("manage-submodules", "build.submodules", "let the build manage the git submodules") -o("jemalloc", "rust.use-jemalloc", "build liballoc with jemalloc") o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two") o("extended", "build.extended", "build an extended rust tool set") @@ -330,8 +328,6 @@ for key in known_args: set('target.{}.llvm-config'.format(build()), value) elif option.name == 'llvm-filecheck': set('target.{}.llvm-filecheck'.format(build()), value) - elif option.name == 'jemalloc-root': - set('target.{}.jemalloc'.format(build()), value + '/libjemalloc_pic.a') elif option.name == 'tools': set('build.tools', value.split(',')) elif option.name == 'host': @@ -393,6 +389,13 @@ for target in configured_targets: targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target) +def is_number(value): + try: + float(value) + return True + except ValueError: + return False + # Here we walk through the constructed configuration we have from the parsed # command line arguments. We then apply each piece of configuration by # basically just doing a `sed` to change the various configuration line to what @@ -406,7 +409,11 @@ def to_toml(value): elif isinstance(value, list): return '[' + ', '.join(map(to_toml, value)) + ']' elif isinstance(value, str): - return "'" + value + "'" + # Don't put quotes around numeric values + if is_number(value): + return value + else: + return "'" + value + "'" else: raise RuntimeError('no toml') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index cf79d4f777a..0aab64465fd 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -31,7 +31,6 @@ use channel; use util::{libdir, is_dylib, exe}; use builder::{Builder, RunConfig, ShouldRun, Step}; use compile; -use native; use tool::{self, Tool}; use cache::{INTERNER, Interned}; use time; @@ -860,8 +859,6 @@ impl Step for Src { "src/build_helper", "src/dlmalloc", "src/liballoc", - "src/liballoc_jemalloc", - "src/liballoc_system", "src/libbacktrace", "src/libcompiler_builtins", "src/libcore", @@ -879,13 +876,12 @@ impl Step for Src { "src/rustc/dlmalloc_shim", "src/libtest", "src/libterm", - "src/jemalloc", "src/libprofiler_builtins", "src/stdsimd", + "src/libproc_macro", ]; let std_src_dirs_exclude = [ "src/libcompiler_builtins/compiler-rt/test", - "src/jemalloc/test/unit", ]; copy_src_dirs(builder, &std_src_dirs[..], &std_src_dirs_exclude[..], &dst_src); @@ -912,7 +908,7 @@ impl Step for Src { } } -const CARGO_VENDOR_VERSION: &str = "0.1.4"; +const CARGO_VENDOR_VERSION: &str = "0.1.19"; #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] pub struct PlainSourceTarball; @@ -990,12 +986,6 @@ impl Step for PlainSourceTarball { .arg("--debug") .arg("--vers").arg(CARGO_VENDOR_VERSION) .arg("cargo-vendor"); - if let Some(dir) = builder.openssl_install_dir(builder.config.build) { - builder.ensure(native::Openssl { - target: builder.config.build, - }); - cmd.env("OPENSSL_DIR", dir); - } builder.run(&mut cmd); } @@ -1454,8 +1444,8 @@ impl Step for Extended { tarballs.extend(rls_installer.clone()); tarballs.extend(clippy_installer.clone()); tarballs.extend(rustfmt_installer.clone()); - tarballs.extend(llvm_tools_installer.clone()); - tarballs.extend(lldb_installer.clone()); + tarballs.extend(llvm_tools_installer); + tarballs.extend(lldb_installer); tarballs.push(analysis_installer); tarballs.push(std_installer); if builder.config.docs { diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 17ccb04a714..7623ca1e27e 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -405,14 +405,15 @@ impl Step for Standalone { cmd.arg("--html-after-content").arg(&footer) .arg("--html-before-content").arg(&version_info) .arg("--html-in-header").arg(&favicon) + .arg("--markdown-no-toc") + .arg("--index-page").arg(&builder.src.join("src/doc/index.md")) .arg("--markdown-playground-url") .arg("https://play.rust-lang.org/") .arg("-o").arg(&out) .arg(&path); if filename == "not_found.md" { - cmd.arg("--markdown-no-toc") - .arg("--markdown-css") + cmd.arg("--markdown-css") .arg("https://doc.rust-lang.org/rust.css"); } else { cmd.arg("--markdown-css").arg("rust.css"); @@ -480,23 +481,31 @@ impl Step for Std { // will also directly handle merging. let my_out = builder.crate_doc_out(target); t!(symlink_dir_force(&builder.config, &my_out, &out_dir)); + t!(fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css"))); - let mut cargo = builder.cargo(compiler, Mode::Std, target, "doc"); - compile::std_cargo(builder, &compiler, target, &mut cargo); + let run_cargo_rustdoc_for = |package: &str| { + let mut cargo = builder.cargo(compiler, Mode::Std, target, "rustdoc"); + compile::std_cargo(builder, &compiler, target, &mut cargo); - // Keep a whitelist so we do not build internal stdlib crates, these will be - // build by the rustc step later if enabled. - cargo.arg("--no-deps"); - for krate in &["alloc", "core", "std"] { - cargo.arg("-p").arg(krate); + // Keep a whitelist so we do not build internal stdlib crates, these will be + // build by the rustc step later if enabled. + cargo.arg("-Z").arg("unstable-options") + .arg("-p").arg(package); // Create all crate output directories first to make sure rustdoc uses // relative links. // FIXME: Cargo should probably do this itself. - t!(fs::create_dir_all(out_dir.join(krate))); + t!(fs::create_dir_all(out_dir.join(package))); + cargo.arg("--") + .arg("--markdown-css").arg("rust.css") + .arg("--markdown-no-toc") + .arg("--index-page").arg(&builder.src.join("src/doc/index.md")); + + builder.run(&mut cargo); + builder.cp_r(&my_out, &out); + }; + for krate in &["alloc", "core", "std"] { + run_cargo_rustdoc_for(krate); } - - builder.run(&mut cargo); - builder.cp_r(&my_out, &out); } } @@ -805,6 +814,7 @@ impl Step for Rustdoc { "doc", "src/tools/rustdoc", SourceType::InTree, + &[] ); cargo.env("RUSTDOCFLAGS", "--document-private-items"); diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 2084b8bdb65..1211d485d1c 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -93,8 +93,7 @@ impl Default for Subcommand { impl Flags { pub fn parse(args: &[String]) -> Flags { let mut extra_help = String::new(); - let mut subcommand_help = format!( - "\ + let mut subcommand_help = String::from("\ Usage: x.py <subcommand> [options] [<paths>...] Subcommands: @@ -365,8 +364,8 @@ Arguments: } let cmd = match subcommand.as_str() { - "build" => Subcommand::Build { paths: paths }, - "check" => Subcommand::Check { paths: paths }, + "build" => Subcommand::Build { paths }, + "check" => Subcommand::Check { paths }, "test" => Subcommand::Test { paths, bless: matches.opt_present("bless"), @@ -386,9 +385,9 @@ Arguments: paths, test_args: matches.opt_strs("test-args"), }, - "doc" => Subcommand::Doc { paths: paths }, + "doc" => Subcommand::Doc { paths }, "clean" => { - if paths.len() > 0 { + if !paths.is_empty() { println!("\nclean does not take a path argument\n"); usage(1, &opts, &subcommand_help, &extra_help); } @@ -413,11 +412,11 @@ Arguments: keep_stage: matches.opt_strs("keep-stage") .into_iter().map(|j| j.parse().unwrap()) .collect(), - host: split(matches.opt_strs("host")) + host: split(&matches.opt_strs("host")) .into_iter() .map(|x| INTERNER.intern_string(x)) .collect::<Vec<_>>(), - target: split(matches.opt_strs("target")) + target: split(&matches.opt_strs("target")) .into_iter() .map(|x| INTERNER.intern_string(x)) .collect::<Vec<_>>(), @@ -425,7 +424,7 @@ Arguments: jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()), cmd, incremental: matches.opt_present("incremental"), - exclude: split(matches.opt_strs("exclude")) + exclude: split(&matches.opt_strs("exclude")) .into_iter() .map(|p| p.into()) .collect::<Vec<_>>(), @@ -488,7 +487,7 @@ impl Subcommand { } } -fn split(s: Vec<String>) -> Vec<String> { +fn split(s: &[String]) -> Vec<String> { s.iter() .flat_map(|s| s.split(',')) .map(|s| s.to_string()) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index c09de02ab51..76697e482d3 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -516,12 +516,6 @@ impl Build { fn std_features(&self) -> String { let mut features = "panic-unwind".to_string(); - if self.config.debug_jemalloc { - features.push_str(" debug-jemalloc"); - } - if self.config.use_jemalloc { - features.push_str(" jemalloc"); - } if self.config.backtrace { features.push_str(" backtrace"); } @@ -537,8 +531,8 @@ impl Build { /// Get the space-separated set of activated features for the compiler. fn rustc_features(&self) -> String { let mut features = String::new(); - if self.config.use_jemalloc { - features.push_str(" jemalloc"); + if self.config.jemalloc { + features.push_str("jemalloc"); } features } @@ -765,10 +759,10 @@ impl Build { let path = match which { GitRepo::Rustc => { - let sha = self.rust_info.sha().expect("failed to find sha"); + let sha = self.rust_sha().unwrap_or(channel::CFG_RELEASE_NUM); format!("/rustc/{}", sha) } - GitRepo::Llvm => format!("/rustc/llvm"), + GitRepo::Llvm => String::from("/rustc/llvm"), }; Some(format!("{}={}", self.src.display(), path)) } @@ -783,7 +777,7 @@ impl Build { fn cflags(&self, target: Interned<String>, which: GitRepo) -> Vec<String> { // Filter out -O and /O (the optimization flags) that we picked up from // cc-rs because the build scripts will determine that for themselves. - let mut base = self.cc[&target].args().iter() + let mut base: Vec<String> = self.cc[&target].args().iter() .map(|s| s.to_string_lossy().into_owned()) .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) .collect::<Vec<_>>(); @@ -791,7 +785,7 @@ impl Build { // If we're compiling on macOS then we add a few unconditional flags // indicating that we want libc++ (more filled out than libstdc++) and // we want to compile for 10.7. This way we can ensure that - // LLVM/jemalloc/etc are all properly compiled. + // LLVM/etc are all properly compiled. if target.contains("apple-darwin") { base.push("-stdlib=libc++".into()); } @@ -806,10 +800,10 @@ impl Build { if let Some(map) = self.debuginfo_map(which) { let cc = self.cc(target); if cc.ends_with("clang") || cc.ends_with("gcc") { - base.push(format!("-fdebug-prefix-map={}", map).into()); + base.push(format!("-fdebug-prefix-map={}", map)); } else if cc.ends_with("clang-cl.exe") { base.push("-Xclang".into()); - base.push(format!("-fdebug-prefix-map={}", map).into()); + base.push(format!("-fdebug-prefix-map={}", map)); } } base @@ -843,7 +837,8 @@ impl Build { } else if target != self.config.build && !target.contains("msvc") && !target.contains("emscripten") && - !target.contains("wasm32") { + !target.contains("wasm32") && + !target.contains("fuchsia") { Some(self.cc(target)) } else { None @@ -926,25 +921,6 @@ impl Build { (self.hosts.iter().any(|h| *h == target) || target == self.build) } - /// Returns the directory that OpenSSL artifacts are compiled into if - /// configured to do so. - fn openssl_dir(&self, target: Interned<String>) -> Option<PathBuf> { - // OpenSSL not used on Windows - if target.contains("windows") { - None - } else if self.config.openssl_static { - Some(self.out.join(&*target).join("openssl")) - } else { - None - } - } - - /// Returns the directory that OpenSSL artifacts are installed into if - /// configured as such. - fn openssl_install_dir(&self, target: Interned<String>) -> Option<PathBuf> { - self.openssl_dir(target).map(|p| p.join("install")) - } - /// Given `num` in the form "a.b.c" return a "release string" which /// describes the release version number. /// diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index bcf2f6a675e..862fbbf1f28 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -85,7 +85,12 @@ check-stage2-T-arm-linux-androideabi-H-x86_64-unknown-linux-gnu: check-stage2-T-x86_64-unknown-linux-musl-H-x86_64-unknown-linux-gnu: $(Q)$(BOOTSTRAP) test --target x86_64-unknown-linux-musl -TESTS_IN_2 := src/test/run-pass src/test/compile-fail src/test/run-pass-fulldeps +TESTS_IN_2 := \ + src/test/ui \ + src/test/run-pass \ + src/test/compile-fail \ + src/test/run-pass-fulldeps \ + src/tools/linkchecker appveyor-subset-1: $(Q)$(BOOTSTRAP) test $(TESTS_IN_2:%=--exclude %) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 424264647f0..448967ef0c2 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -353,7 +353,7 @@ fn configure_cmake(builder: &Builder, // definitely causes problems since all the env vars are pointing to // 32-bit libraries. // - // To hack aroudn this... again... we pass an argument that's + // To hack around this... again... we pass an argument that's // unconditionally passed in the sccache shim. This'll get CMake to // correctly diagnose it's doing a 32-bit compilation and LLVM will // internally configure itself appropriately. @@ -361,7 +361,7 @@ fn configure_cmake(builder: &Builder, cfg.env("SCCACHE_EXTRA_ARGS", "-m32"); } - // If ccache is configured we inform the build a little differently hwo + // If ccache is configured we inform the build a little differently how // to invoke ccache while also invoking our compilers. } else if let Some(ref ccache) = builder.config.ccache { cfg.define("CMAKE_C_COMPILER", ccache) @@ -531,189 +531,3 @@ impl Step for TestHelpers { .compile("rust_test_helpers"); } } - -const OPENSSL_VERS: &'static str = "1.0.2n"; -const OPENSSL_SHA256: &'static str = - "370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe"; - -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Openssl { - pub target: Interned<String>, -} - -impl Step for Openssl { - type Output = (); - - fn should_run(run: ShouldRun) -> ShouldRun { - run.never() - } - - fn run(self, builder: &Builder) { - if builder.config.dry_run { - return; - } - let target = self.target; - let out = match builder.openssl_dir(target) { - Some(dir) => dir, - None => return, - }; - - let stamp = out.join(".stamp"); - let mut contents = String::new(); - drop(File::open(&stamp).and_then(|mut f| f.read_to_string(&mut contents))); - if contents == OPENSSL_VERS { - return - } - t!(fs::create_dir_all(&out)); - - let name = format!("openssl-{}.tar.gz", OPENSSL_VERS); - let tarball = out.join(&name); - if !tarball.exists() { - let tmp = tarball.with_extension("tmp"); - // originally from https://www.openssl.org/source/... - let url = format!("https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/{}", - name); - let mut last_error = None; - for _ in 0..3 { - let status = Command::new("curl") - .arg("-o").arg(&tmp) - .arg("-f") // make curl fail if the URL does not return HTTP 200 - .arg(&url) - .status() - .expect("failed to spawn curl"); - - // Retry if download failed. - if !status.success() { - last_error = Some(status.to_string()); - continue; - } - - // Ensure the hash is correct. - let mut shasum = if target.contains("apple") || - builder.config.build.contains("netbsd") { - let mut cmd = Command::new("shasum"); - cmd.arg("-a").arg("256"); - cmd - } else { - Command::new("sha256sum") - }; - let output = output(&mut shasum.arg(&tmp)); - let found = output.split_whitespace().next().unwrap(); - - // If the hash is wrong, probably the download is incomplete or S3 served an error - // page. In any case, retry. - if found != OPENSSL_SHA256 { - last_error = Some(format!( - "downloaded openssl sha256 different\n\ - expected: {}\n\ - found: {}\n", - OPENSSL_SHA256, - found - )); - continue; - } - - // Everything is fine, so exit the retry loop. - last_error = None; - break; - } - if let Some(error) = last_error { - panic!("failed to download openssl source: {}", error); - } - t!(fs::rename(&tmp, &tarball)); - } - let obj = out.join(format!("openssl-{}", OPENSSL_VERS)); - let dst = builder.openssl_install_dir(target).unwrap(); - drop(fs::remove_dir_all(&obj)); - drop(fs::remove_dir_all(&dst)); - builder.run(Command::new("tar").arg("zxf").arg(&tarball).current_dir(&out)); - - let mut configure = Command::new("perl"); - configure.arg(obj.join("Configure")); - configure.arg(format!("--prefix={}", dst.display())); - configure.arg("no-dso"); - configure.arg("no-ssl2"); - configure.arg("no-ssl3"); - - let os = match &*target { - "aarch64-linux-android" => "linux-aarch64", - "aarch64-unknown-linux-gnu" => "linux-aarch64", - "aarch64-unknown-linux-musl" => "linux-aarch64", - "aarch64-unknown-netbsd" => "BSD-generic64", - "arm-linux-androideabi" => "android", - "arm-unknown-linux-gnueabi" => "linux-armv4", - "arm-unknown-linux-gnueabihf" => "linux-armv4", - "armv6-unknown-netbsd-eabihf" => "BSD-generic32", - "armv7-linux-androideabi" => "android-armv7", - "armv7-unknown-linux-gnueabihf" => "linux-armv4", - "armv7-unknown-netbsd-eabihf" => "BSD-generic32", - "i586-unknown-linux-gnu" => "linux-elf", - "i586-unknown-linux-musl" => "linux-elf", - "i686-apple-darwin" => "darwin-i386-cc", - "i686-linux-android" => "android-x86", - "i686-unknown-freebsd" => "BSD-x86-elf", - "i686-unknown-linux-gnu" => "linux-elf", - "i686-unknown-linux-musl" => "linux-elf", - "i686-unknown-netbsd" => "BSD-x86-elf", - "mips-unknown-linux-gnu" => "linux-mips32", - "mips64-unknown-linux-gnuabi64" => "linux64-mips64", - "mips64el-unknown-linux-gnuabi64" => "linux64-mips64", - "mipsel-unknown-linux-gnu" => "linux-mips32", - "powerpc-unknown-linux-gnu" => "linux-ppc", - "powerpc-unknown-linux-gnuspe" => "linux-ppc", - "powerpc-unknown-netbsd" => "BSD-generic32", - "powerpc64-unknown-linux-gnu" => "linux-ppc64", - "powerpc64le-unknown-linux-gnu" => "linux-ppc64le", - "powerpc64le-unknown-linux-musl" => "linux-ppc64le", - "s390x-unknown-linux-gnu" => "linux64-s390x", - "sparc-unknown-linux-gnu" => "linux-sparcv9", - "sparc64-unknown-linux-gnu" => "linux64-sparcv9", - "sparc64-unknown-netbsd" => "BSD-sparc64", - "x86_64-apple-darwin" => "darwin64-x86_64-cc", - "x86_64-linux-android" => "linux-x86_64", - "x86_64-unknown-freebsd" => "BSD-x86_64", - "x86_64-unknown-dragonfly" => "BSD-x86_64", - "x86_64-unknown-linux-gnu" => "linux-x86_64", - "x86_64-unknown-linux-gnux32" => "linux-x32", - "x86_64-unknown-linux-musl" => "linux-x86_64", - "x86_64-unknown-netbsd" => "BSD-x86_64", - _ => panic!("don't know how to configure OpenSSL for {}", target), - }; - configure.arg(os); - configure.env("CC", builder.cc(target)); - for flag in builder.cflags(target, GitRepo::Rustc) { - configure.arg(flag); - } - // There is no specific os target for android aarch64 or x86_64, - // so we need to pass some extra cflags - if target == "aarch64-linux-android" || target == "x86_64-linux-android" { - configure.arg("-mandroid"); - configure.arg("-fomit-frame-pointer"); - } - if target == "sparc64-unknown-netbsd" { - // Need -m64 to get assembly generated correctly for sparc64. - configure.arg("-m64"); - if builder.config.build.contains("netbsd") { - // Disable sparc64 asm on NetBSD builders, it uses - // m4(1)'s -B flag, which NetBSD m4 does not support. - configure.arg("no-asm"); - } - } - // Make PIE binaries - // Non-PIE linker support was removed in Lollipop - // https://source.android.com/security/enhancements/enhancements50 - if target == "i686-linux-android" { - configure.arg("no-asm"); - } - configure.current_dir(&obj); - builder.info(&format!("Configuring openssl for {}", target)); - builder.run_quiet(&mut configure); - builder.info(&format!("Building openssl for {}", target)); - builder.run_quiet(Command::new("make").arg("-j1").current_dir(&obj)); - builder.info(&format!("Installing openssl for {}", target)); - builder.run_quiet(Command::new("make").arg("install").arg("-j1").current_dir(&obj)); - - let mut f = t!(File::create(&stamp)); - t!(f.write_all(OPENSSL_VERS.as_bytes())); - } -} diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 724cb5841f4..15d3bccba09 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -74,7 +74,7 @@ pub fn check(build: &mut Build) { // one is present as part of the PATH then that can lead to the system // being unable to identify the files properly. See // https://github.com/rust-lang/rust/issues/34959 for more details. - if cfg!(windows) && path.to_string_lossy().contains("\"") { + if cfg!(windows) && path.to_string_lossy().contains('\"') { panic!("PATH contains invalid character '\"'"); } @@ -152,12 +152,6 @@ pub fn check(build: &mut Build) { if !build.config.dry_run { cmd_finder.must_have(build.cxx(*host).unwrap()); } - - // The msvc hosts don't use jemalloc, turn it off globally to - // avoid packaging the dummy liballoc_jemalloc on that platform. - if host.contains("msvc") { - build.config.use_jemalloc = false; - } } // Externally configured LLVM requires FileCheck to exist diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 80c89b9ff38..e55773011df 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -228,7 +228,8 @@ impl Step for Cargo { self.host, "test", "src/tools/cargo", - SourceType::Submodule); + SourceType::Submodule, + &[]); if !builder.fail_fast { cargo.arg("--no-fail-fast"); @@ -290,7 +291,8 @@ impl Step for Rls { host, "test", "src/tools/rls", - SourceType::Submodule); + SourceType::Submodule, + &[]); // Copy `src/tools/rls/test_data` to a writable drive. let test_workspace_path = builder.out.join("rls-test-data"); @@ -352,7 +354,8 @@ impl Step for Rustfmt { host, "test", "src/tools/rustfmt", - SourceType::Submodule); + SourceType::Submodule, + &[]); let dir = testdir(builder, compiler.host); t!(fs::create_dir_all(&dir)); @@ -407,7 +410,8 @@ impl Step for Miri { host, "test", "src/tools/miri", - SourceType::Submodule); + SourceType::Submodule, + &[]); // miri tests need to know about the stage sysroot cargo.env("MIRI_SYSROOT", builder.sysroot(compiler)); @@ -466,7 +470,8 @@ impl Step for Clippy { host, "test", "src/tools/clippy", - SourceType::Submodule); + SourceType::Submodule, + &[]); // clippy tests need to know about the stage sysroot cargo.env("SYSROOT", builder.sysroot(compiler)); @@ -516,7 +521,7 @@ impl Step for RustdocTheme { fn make_run(run: RunConfig) { let compiler = run.builder.compiler(run.builder.top_stage, run.host); - run.builder.ensure(RustdocTheme { compiler: compiler }); + run.builder.ensure(RustdocTheme { compiler }); } fn run(self, builder: &Builder) { @@ -579,9 +584,9 @@ impl Step for RustdocJS { }); builder.run(&mut command); } else { - builder.info(&format!( + builder.info( "No nodejs found, skipping \"src/test/rustdoc-js\" tests" - )); + ); } } } @@ -648,7 +653,7 @@ impl Step for Tidy { } let _folder = builder.fold_output(|| "tidy"); - builder.info(&format!("tidy check")); + builder.info("tidy check"); try_run(builder, &mut cmd); } @@ -768,12 +773,6 @@ default_test!(CompileFail { suite: "compile-fail" }); -default_test!(ParseFail { - path: "src/test/parse-fail", - mode: "parse-fail", - suite: "parse-fail" -}); - default_test!(RunFail { path: "src/test/run-fail", mode: "run-fail", @@ -1053,7 +1052,7 @@ impl Step for Compiletest { let hostflags = flags.clone(); cmd.arg("--host-rustcflags").arg(hostflags.join(" ")); - let mut targetflags = flags.clone(); + let mut targetflags = flags; targetflags.push(format!( "-Lnative={}", builder.test_helpers_out(target).display() @@ -1169,9 +1168,9 @@ impl Step for Compiletest { } } if suite == "run-make-fulldeps" && !builder.config.llvm_enabled { - builder.info(&format!( + builder.info( "Ignoring run-make test suite as they generally don't work without LLVM" - )); + ); return; } @@ -1505,8 +1504,7 @@ impl Step for CrateNotDefault { type Output = (); fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/liballoc_jemalloc") - .path("src/librustc_asan") + run.path("src/librustc_asan") .path("src/librustc_lsan") .path("src/librustc_msan") .path("src/librustc_tsan") @@ -1523,7 +1521,6 @@ impl Step for CrateNotDefault { target: run.target, test_kind, krate: match run.path { - _ if run.path.ends_with("src/liballoc_jemalloc") => "alloc_jemalloc", _ if run.path.ends_with("src/librustc_asan") => "rustc_asan", _ if run.path.ends_with("src/librustc_lsan") => "rustc_lsan", _ if run.path.ends_with("src/librustc_msan") => "rustc_msan", @@ -1562,7 +1559,6 @@ impl Step for Crate { run = run.krate("test"); for krate in run.builder.in_tree_crates("std") { if krate.is_local(&run.builder) - && !krate.name.contains("jemalloc") && !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) && krate.name != "dlmalloc" { @@ -1693,10 +1689,10 @@ impl Step for Crate { // The javascript shim implements the syscall interface so that test // output can be correctly reported. if !builder.config.wasm_syscall { - builder.info(&format!( + builder.info( "Libstd was built without `wasm_syscall` feature enabled: \ test output may not be visible." - )); + ); } // On the wasm32-unknown-unknown target we're using LTO which is @@ -1777,7 +1773,8 @@ impl Step for CrateRustdoc { target, test_kind.subcommand(), "src/tools/rustdoc", - SourceType::InTree); + SourceType::InTree, + &[]); if test_kind.subcommand() == "test" && !builder.fail_fast { cargo.arg("--no-fail-fast"); } @@ -1891,7 +1888,7 @@ impl Step for Distcheck { /// Run "distcheck", a 'make check' from a tarball fn run(self, builder: &Builder) { - builder.info(&format!("Distcheck")); + builder.info("Distcheck"); let dir = builder.out.join("tmp").join("distcheck"); let _ = fs::remove_dir_all(&dir); t!(fs::create_dir_all(&dir)); @@ -1919,7 +1916,7 @@ impl Step for Distcheck { ); // Now make sure that rust-src has all of libstd's dependencies - builder.info(&format!("Distcheck rust-src")); + builder.info("Distcheck rust-src"); let dir = builder.out.join("tmp").join("distcheck-src"); let _ = fs::remove_dir_all(&dir); t!(fs::create_dir_all(&dir)); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index e5299761a15..978e3602e7d 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -80,8 +80,8 @@ impl Step for ToolBuild { "build", path, self.source_type, + &self.extra_features, ); - cargo.arg("--features").arg(self.extra_features.join(" ")); let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool)); builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target)); @@ -148,7 +148,7 @@ impl Step for ToolBuild { } }); - if is_expected && duplicates.len() != 0 { + if is_expected && !duplicates.is_empty() { println!("duplicate artfacts found when compiling a tool, this \ typically means that something was recompiled because \ a transitive dependency has different features activated \ @@ -170,7 +170,7 @@ impl Step for ToolBuild { println!(" `{}` additionally enabled features {:?} at {:?}", prev.0, &prev_features - &cur_features, prev.1); } - println!(""); + println!(); println!("to fix this you will probably want to edit the local \ src/tools/rustc-workspace-hack/Cargo.toml crate, as \ that will update the dependency graph to ensure that \ @@ -188,7 +188,7 @@ impl Step for ToolBuild { if !is_optional_tool { exit(1); } else { - return None; + None } } else { let cargo_out = builder.cargo_out(compiler, self.mode, target) @@ -208,6 +208,7 @@ pub fn prepare_tool_cargo( command: &'static str, path: &'static str, source_type: SourceType, + extra_features: &[String], ) -> Command { let mut cargo = builder.cargo(compiler, mode, target, command); let dir = builder.src.join(path); @@ -221,10 +222,16 @@ pub fn prepare_tool_cargo( cargo.env("RUSTC_EXTERNAL_TOOL", "1"); } - if let Some(dir) = builder.openssl_install_dir(target) { - cargo.env("OPENSSL_STATIC", "1"); - cargo.env("OPENSSL_DIR", dir); - cargo.env("LIBZ_SYS_STATIC", "1"); + let mut features = extra_features.iter().cloned().collect::<Vec<_>>(); + if builder.build.config.cargo_native_static { + if path.ends_with("cargo") || + path.ends_with("rls") || + path.ends_with("clippy") || + path.ends_with("rustfmt") + { + cargo.env("LIBZ_SYS_STATIC", "1"); + features.push("rustc-workspace-hack/all-static".to_string()); + } } // if tools are using lzma we want to force the build script to build its @@ -244,6 +251,9 @@ pub fn prepare_tool_cargo( if let Some(date) = info.commit_date() { cargo.env("CFG_COMMIT_DATE", date); } + if !features.is_empty() { + cargo.arg("--features").arg(&features.join(", ")); + } cargo } @@ -439,6 +449,7 @@ impl Step for Rustdoc { "build", "src/tools/rustdoc", SourceType::InTree, + &[], ); // Most tools don't get debuginfo, but rustdoc should. @@ -495,9 +506,6 @@ impl Step for Cargo { } fn run(self, builder: &Builder) -> PathBuf { - builder.ensure(native::Openssl { - target: self.target, - }); // Cargo depends on procedural macros, which requires a full host // compiler to be available, so we need to depend on that. builder.ensure(compile::Rustc { @@ -597,9 +605,6 @@ tool_extended!((self, builder), if clippy.is_some() { self.extra_features.push("clippy".to_owned()); } - builder.ensure(native::Openssl { - target: self.target, - }); // RLS depends on procedural macros, which requires a full host // compiler to be available, so we need to depend on that. builder.ensure(compile::Rustc {  | 
