From 8909c4dc315bf1686449e762958558893c420923 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 8 Dec 2020 19:18:06 -0500 Subject: Fix rustup support in default_build_triple for python3 bootstrap completely ignores all errors when detecting a rustup version, so this wasn't noticed before. Fixes the following error: ``` rustup not detected: a bytes-like object is required, not 'str' falling back to auto-detect ``` This also takes the opportunity to only call rustup and other external commands only once during startup. --- src/bootstrap/bootstrap.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index a819e1b6e2f..f919f63e579 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -192,8 +192,10 @@ def default_build_triple(verbose): # If the user already has a host build triple with an existing `rustc` # install, use their preference. This fixes most issues with Windows builds # being detected as GNU instead of MSVC. + default_encoding = sys.getdefaultencoding() try: version = subprocess.check_output(["rustc", "--version", "--verbose"]) + version = version.decode(default_encoding) host = next(x for x in version.split('\n') if x.startswith("host: ")) triple = host.split("host: ")[1] if verbose: @@ -204,7 +206,6 @@ def default_build_triple(verbose): print("rustup not detected: {}".format(e)) print("falling back to auto-detect") - default_encoding = sys.getdefaultencoding() required = sys.platform != 'win32' ostype = require(["uname", "-s"], exit=required) cputype = require(['uname', '-m'], exit=required) @@ -794,7 +795,7 @@ class RustBuild(object): env.setdefault("RUSTFLAGS", "") env["RUSTFLAGS"] += " -Cdebuginfo=2" - build_section = "target.{}".format(self.build_triple()) + build_section = "target.{}".format(self.build) target_features = [] if self.get_toml("crt-static", build_section) == "true": target_features += ["+crt-static"] @@ -825,7 +826,11 @@ class RustBuild(object): run(args, env=env, verbose=self.verbose) def build_triple(self): - """Build triple as in LLVM""" + """Build triple as in LLVM + + Note that `default_build_triple` is moderately expensive, + so use `self.build` where possible. + """ config = self.get_toml('build') if config: return config -- cgit 1.4.1-3-g733a5 From 5c8de1cf4971e5800e2dd33393eef7ad7b8b78be Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Fri, 11 Dec 2020 17:32:03 +0100 Subject: use strip_prefix over slicing (clippy::manual_strip) --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 ++-- compiler/rustc_llvm/build.rs | 36 ++++++++++++++-------------- src/bootstrap/dist.rs | 2 +- src/librustdoc/html/markdown.rs | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index ec557b7a682..bf0d499e6c4 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -854,8 +854,8 @@ fn generic_simd_intrinsic( )); } - if name_str.starts_with("simd_shuffle") { - let n: u64 = name_str["simd_shuffle".len()..].parse().unwrap_or_else(|_| { + if let Some(stripped) = name_str.strip_prefix("simd_shuffle") { + let n: u64 = stripped.parse().unwrap_or_else(|_| { span_bug!(span, "bad `simd_shuffle` instruction only caught in codegen?") }); diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 54b22ca49a2..621363bed80 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -201,10 +201,10 @@ fn main() { cmd.args(&components); for lib in output(&mut cmd).split_whitespace() { - let name = if lib.starts_with("-l") { - &lib[2..] - } else if lib.starts_with('-') { - &lib[1..] + let name = if let Some(stripped) = lib.strip_prefix("-l") { + stripped + } else if let Some(stripped) = lib.strip_prefix('-') { + stripped } else if Path::new(lib).exists() { // On MSVC llvm-config will print the full name to libraries, but // we're only interested in the name part @@ -241,17 +241,17 @@ fn main() { cmd.arg(llvm_link_arg).arg("--ldflags"); for lib in output(&mut cmd).split_whitespace() { if is_crossed { - if lib.starts_with("-LIBPATH:") { - println!("cargo:rustc-link-search=native={}", lib[9..].replace(&host, &target)); - } else if lib.starts_with("-L") { - println!("cargo:rustc-link-search=native={}", lib[2..].replace(&host, &target)); + if let Some(stripped) = lib.strip_prefix("-LIBPATH:") { + println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target)); + } else if let Some(stripped) = lib.strip_prefix("-L") { + println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target)); } - } else if lib.starts_with("-LIBPATH:") { - println!("cargo:rustc-link-search=native={}", &lib[9..]); - } else if lib.starts_with("-l") { - println!("cargo:rustc-link-lib={}", &lib[2..]); - } else if lib.starts_with("-L") { - println!("cargo:rustc-link-search=native={}", &lib[2..]); + } else if let Some(stripped) = lib.strip_prefix("-LIBPATH:") { + println!("cargo:rustc-link-search=native={}", stripped); + } else if let Some(stripped) = lib.strip_prefix("-l") { + println!("cargo:rustc-link-lib={}", stripped); + } else if let Some(stripped) = lib.strip_prefix("-L") { + println!("cargo:rustc-link-search=native={}", stripped); } } @@ -262,10 +262,10 @@ fn main() { let llvm_linker_flags = tracked_env_var_os("LLVM_LINKER_FLAGS"); if let Some(s) = llvm_linker_flags { for lib in s.into_string().unwrap().split_whitespace() { - if lib.starts_with("-l") { - println!("cargo:rustc-link-lib={}", &lib[2..]); - } else if lib.starts_with("-L") { - println!("cargo:rustc-link-search=native={}", &lib[2..]); + if let Some(stripped) = lib.strip_prefix("-l") { + println!("cargo:rustc-link-lib={}", stripped); + } else if let Some(stripped) = lib.strip_prefix("-L") { + println!("cargo:rustc-link-search=native={}", stripped); } } } diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 354be109cf2..360e51ed2bb 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1186,7 +1186,7 @@ pub fn sanitize_sh(path: &Path) -> String { return change_drive(unc_to_lfs(&path)).unwrap_or(path); fn unc_to_lfs(s: &str) -> &str { - if s.starts_with("//?/") { &s[4..] } else { s } + s.strip_prefix("//?/").unwrap_or(s) } fn change_drive(s: &str) -> Option { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index bdbb90837c7..22096203d4c 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -139,9 +139,9 @@ fn map_line(s: &str) -> Line<'_> { let trimmed = s.trim(); if trimmed.starts_with("##") { Line::Shown(Cow::Owned(s.replacen("##", "#", 1))) - } else if trimmed.starts_with("# ") { + } else if let Some(stripped) = trimmed.strip_prefix("# ") { // # text - Line::Hidden(&trimmed[2..]) + Line::Hidden(&stripped) } else if trimmed == "#" { // We cannot handle '#text' because it could be #[attr]. Line::Hidden("") -- cgit 1.4.1-3-g733a5 From db6c50998c929c9bab5ea2ffdddf5e0eef25d3c8 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Fri, 11 Dec 2020 17:49:00 +0100 Subject: don't clone types that are copy (clippy::clone_on_copy) --- compiler/rustc_mir/src/transform/early_otherwise_branch.rs | 2 +- compiler/rustc_trait_selection/src/traits/select/confirmation.rs | 4 ++-- compiler/rustc_typeck/src/check/upvar.rs | 2 +- src/bootstrap/sanity.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index f91477911a4..0460ebe0c0d 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -217,7 +217,7 @@ impl<'a, 'tcx> Helper<'a, 'tcx> { // go through each target, finding a discriminant read, and a switch let results = discr.targets_with_values.iter().map(|(value, target)| { - self.find_discriminant_switch_pairing(&discr, target.clone(), value.clone()) + self.find_discriminant_switch_pairing(&discr, *target, *value) }); // if the optimization did not apply for one of the targets, then abort diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index a42c8021346..ed22d5849e2 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -447,7 +447,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ); nested.push(Obligation::new( obligation.cause.clone(), - obligation.param_env.clone(), + obligation.param_env, normalized_super_trait, )); } @@ -485,7 +485,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ); nested.push(Obligation::new( obligation.cause.clone(), - obligation.param_env.clone(), + obligation.param_env, normalized_bound, )); } diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 019fa78fb1e..373f2307019 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -303,7 +303,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // upvar_capture_map only stores the UpvarCapture (CaptureKind), // so we create a fake capture info with no expression. let fake_capture_info = - ty::CaptureInfo { expr_id: None, capture_kind: capture_kind.clone() }; + ty::CaptureInfo { expr_id: None, capture_kind: *capture_kind }; determine_capture_info(fake_capture_info, capture_info).capture_kind } else { capture_info.capture_kind diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 4cfcf6ca407..aafb71629ad 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -162,7 +162,7 @@ pub fn check(build: &mut Build) { build .config .target_config - .entry(target.clone()) + .entry(*target) .or_insert(Target::from_triple(&target.triple)); if target.contains("-none-") || target.contains("nvptx") { @@ -176,7 +176,7 @@ pub fn check(build: &mut Build) { // If this is a native target (host is also musl) and no musl-root is given, // fall back to the system toolchain in /usr before giving up if build.musl_root(*target).is_none() && build.config.build == *target { - let target = build.config.target_config.entry(target.clone()).or_default(); + let target = build.config.target_config.entry(*target).or_default(); target.musl_root = Some("/usr".into()); } match build.musl_libdir(*target) { -- cgit 1.4.1-3-g733a5 From b7795e135a642df024fc9bfee72abf7981c89ec8 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Fri, 11 Dec 2020 18:08:05 +0100 Subject: fix clippy::{needless_bool, manual_unwrap_or} --- .../src/transform/early_otherwise_branch.rs | 7 ++++--- compiler/rustc_session/src/session.rs | 5 +---- compiler/rustc_typeck/src/check/upvar.rs | 21 ++++++++++----------- compiler/rustc_typeck/src/collect.rs | 7 +------ src/bootstrap/sanity.rs | 6 +----- 5 files changed, 17 insertions(+), 29 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index 0460ebe0c0d..6fbcc140978 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -216,9 +216,10 @@ impl<'a, 'tcx> Helper<'a, 'tcx> { let discr = self.find_switch_discriminant_info(bb, switch)?; // go through each target, finding a discriminant read, and a switch - let results = discr.targets_with_values.iter().map(|(value, target)| { - self.find_discriminant_switch_pairing(&discr, *target, *value) - }); + let results = discr + .targets_with_values + .iter() + .map(|(value, target)| self.find_discriminant_switch_pairing(&discr, *target, *value)); // if the optimization did not apply for one of the targets, then abort if results.clone().any(|x| x.is_none()) || results.len() == 0 { diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 4e269f3172c..75faab12e3e 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1109,10 +1109,7 @@ impl Session { } pub fn link_dead_code(&self) -> bool { - match self.opts.cg.link_dead_code { - Some(explicitly_set) => explicitly_set, - None => false, - } + self.opts.cg.link_dead_code.unwrap_or(false) } pub fn mark_attr_known(&self, attr: &Attribute) { diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 373f2307019..1b04351018a 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -297,17 +297,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { closure_captures.insert(*var_hir_id, upvar_id); - let new_capture_kind = if let Some(capture_kind) = - upvar_capture_map.get(&upvar_id) - { - // upvar_capture_map only stores the UpvarCapture (CaptureKind), - // so we create a fake capture info with no expression. - let fake_capture_info = - ty::CaptureInfo { expr_id: None, capture_kind: *capture_kind }; - determine_capture_info(fake_capture_info, capture_info).capture_kind - } else { - capture_info.capture_kind - }; + let new_capture_kind = + if let Some(capture_kind) = upvar_capture_map.get(&upvar_id) { + // upvar_capture_map only stores the UpvarCapture (CaptureKind), + // so we create a fake capture info with no expression. + let fake_capture_info = + ty::CaptureInfo { expr_id: None, capture_kind: *capture_kind }; + determine_capture_info(fake_capture_info, capture_info).capture_kind + } else { + capture_info.capture_kind + }; upvar_capture_map.insert(upvar_id, new_capture_kind); } } diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 38da1e5ea03..c70554cc627 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -2141,13 +2141,8 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat // * It must be an associated type for this trait (*not* a // supertrait). if let ty::Projection(projection) = ty.kind() { - if projection.substs == trait_identity_substs + projection.substs == trait_identity_substs && tcx.associated_item(projection.item_def_id).container.id() == def_id - { - true - } else { - false - } } else { false } diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index aafb71629ad..85b4a73439d 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -159,11 +159,7 @@ pub fn check(build: &mut Build) { panic!("the iOS target is only supported on macOS"); } - build - .config - .target_config - .entry(*target) - .or_insert(Target::from_triple(&target.triple)); + build.config.target_config.entry(*target).or_insert(Target::from_triple(&target.triple)); if target.contains("-none-") || target.contains("nvptx") { if build.no_std(*target) == Some(false) { -- cgit 1.4.1-3-g733a5 From 16f69b5430cd543d5767401d760cc644dc836906 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 12 Dec 2020 18:02:37 +0100 Subject: Don't checkout llvm-project when the LLVM backend isn't built --- src/bootstrap/bootstrap.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index a819e1b6e2f..63975c6deda 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -892,13 +892,17 @@ class RustBuild(object): filtered_submodules = [] submodules_names = [] llvm_checked_out = os.path.exists(os.path.join(self.rust_root, "src/llvm-project/.git")) + external_llvm_provided = self.get_toml('llvm-config') or self.downloading_llvm() + llvm_needed = not self.get_toml('codegen-backends', 'rust') \ + or "llvm" in self.get_toml('codegen-backends', 'rust') for module in submodules: if module.endswith("llvm-project"): - # Don't sync the llvm-project submodule either if an external LLVM - # was provided, or if we are downloading LLVM. Also, if the - # submodule has been initialized already, sync it anyways so that - # it doesn't mess up contributor pull requests. - if self.get_toml('llvm-config') or self.downloading_llvm(): + # Don't sync the llvm-project submodule if an external LLVM was + # provided, if we are downloading LLVM or if the LLVM backend is + # not being built. Also, if the submodule has been initialized + # already, sync it anyways so that it doesn't mess up contributor + # pull requests. + if external_llvm_provided or not llvm_needed: if self.get_toml('lld') != 'true' and not llvm_checked_out: continue check = self.check_submodule(module, slow_submodules) -- cgit 1.4.1-3-g733a5 From d79e19f3320be33f280a2b2eeb2e1ffd7f8f9162 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 12 Dec 2020 18:13:04 +0100 Subject: Don't require cmake and ninja when the LLVM backend is not used --- src/bootstrap/sanity.rs | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 4cfcf6ca407..8d7ad345ab4 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -17,6 +17,7 @@ use std::process::Command; use build_helper::{output, t}; +use crate::cache::INTERNER; use crate::config::Target; use crate::Build; @@ -79,18 +80,19 @@ pub fn check(build: &mut Build) { } // We need cmake, but only if we're actually building LLVM or sanitizers. - let building_llvm = build - .hosts - .iter() - .map(|host| { - build - .config - .target_config - .get(host) - .map(|config| config.llvm_config.is_none()) - .unwrap_or(true) - }) - .any(|build_llvm_ourselves| build_llvm_ourselves); + let building_llvm = build.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) + && build + .hosts + .iter() + .map(|host| { + build + .config + .target_config + .get(host) + .map(|config| config.llvm_config.is_none()) + .unwrap_or(true) + }) + .any(|build_llvm_ourselves| build_llvm_ourselves); if building_llvm || build.config.any_sanitizers_enabled() { cmd_finder.must_have("cmake"); } @@ -147,10 +149,12 @@ pub fn check(build: &mut Build) { } } - // Externally configured LLVM requires FileCheck to exist - let filecheck = build.llvm_filecheck(build.build); - if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests { - panic!("FileCheck executable {:?} does not exist", filecheck); + if build.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) { + // Externally configured LLVM requires FileCheck to exist + let filecheck = build.llvm_filecheck(build.build); + if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests { + panic!("FileCheck executable {:?} does not exist", filecheck); + } } for target in &build.targets { -- cgit 1.4.1-3-g733a5 From 9df0348299df0a0ceeefd587700cabea6adc2d53 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 11 Dec 2020 20:27:28 -0500 Subject: Fix building compiler docs with stage 0 --- src/bootstrap/builder.rs | 5 ++++- src/bootstrap/doc.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 6d97943548d..9af79e20630 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -732,11 +732,14 @@ impl<'a> Builder<'a> { .env("CFG_RELEASE_CHANNEL", &self.config.channel) .env("RUSTDOC_REAL", self.rustdoc(compiler)) .env("RUSTC_BOOTSTRAP", "1") - .arg("-Znormalize_docs") .arg("-Winvalid_codeblock_attributes"); if self.config.deny_warnings { cmd.arg("-Dwarnings"); } + // cfg(not(bootstrap)), can be removed on the next beta bump + if compiler.stage != 0 { + cmd.arg("-Znormalize-docs"); + } // Remove make-related flags that can cause jobserver problems. cmd.env_remove("MAKEFLAGS"); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index a296a1fe3f4..8cacc2512ef 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -527,7 +527,10 @@ impl Step for Rustc { cargo.rustdocflag("--document-private-items"); cargo.rustdocflag("--enable-index-page"); cargo.rustdocflag("-Zunstable-options"); - cargo.rustdocflag("-Znormalize-docs"); + // cfg(not(bootstrap)), can be removed on the next beta bump + if stage != 0 { + cargo.rustdocflag("-Znormalize-docs"); + } compile::rustc_cargo(builder, &mut cargo, target); // Only include compiler crates, no dependencies of those, such as `libc`. -- cgit 1.4.1-3-g733a5 From 241160de72b5b55187ca54243e2a6e82e336d07c Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 14 Oct 2020 18:16:05 +0100 Subject: bootstrap: copy `llvm-dwp` to sysroot `llvm-dwp` is required for linking the DWARF objects into DWARF packages when using Split DWARF, especially given that rustc produces multiple DWARF objects (one for each codegen unit). Signed-off-by: David Wood --- src/bootstrap/compile.rs | 20 +++++++++++++++----- src/bootstrap/dist.rs | 15 +++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index cdad1cb4d49..fbebb26c746 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -969,15 +969,25 @@ impl Step for Assemble { copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler); + // We prepend this bin directory to the user PATH when linking Rust binaries. To + // avoid shadowing the system LLD we rename the LLD we provide to `rust-lld`. let libdir = builder.sysroot_libdir(target_compiler, target_compiler.host); + let libdir_bin = libdir.parent().unwrap().join("bin"); + t!(fs::create_dir_all(&libdir_bin)); + if let Some(lld_install) = lld_install { let src_exe = exe("lld", target_compiler.host); let dst_exe = exe("rust-lld", target_compiler.host); - // we prepend this bin directory to the user PATH when linking Rust binaries. To - // avoid shadowing the system LLD we rename the LLD we provide to `rust-lld`. - let dst = libdir.parent().unwrap().join("bin"); - t!(fs::create_dir_all(&dst)); - builder.copy(&lld_install.join("bin").join(&src_exe), &dst.join(&dst_exe)); + builder.copy(&lld_install.join("bin").join(&src_exe), &libdir_bin.join(&dst_exe)); + } + + // Similarly, copy `llvm-dwp` into libdir for Split DWARF. + { + let src_exe = exe("llvm-dwp", target_compiler.host); + let dst_exe = exe("rust-llvm-dwp", target_compiler.host); + let llvm_config_bin = builder.ensure(native::Llvm { target: target_compiler.host }); + let llvm_bin_dir = llvm_config_bin.parent().unwrap(); + builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); } // Ensure that `libLLVM.so` ends up in the newly build compiler directory, diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 360e51ed2bb..25905895116 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -523,17 +523,20 @@ impl Step for Rustc { // component for now. maybe_install_llvm_runtime(builder, host, image); + let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin"); + let dst_dir = image.join("lib/rustlib").join(&*host.triple).join("bin"); + t!(fs::create_dir_all(&dst_dir)); + // Copy over lld if it's there if builder.config.lld_enabled { let exe = exe("rust-lld", compiler.host); - let src = - builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin").join(&exe); - // for the rationale about this rename check `compile::copy_lld_to_sysroot` - let dst = image.join("lib/rustlib").join(&*host.triple).join("bin").join(&exe); - t!(fs::create_dir_all(&dst.parent().unwrap())); - builder.copy(&src, &dst); + builder.copy(&src_dir.join(&exe), &dst_dir.join(&exe)); } + // Copy over llvm-dwp if it's there + let exe = exe("rust-llvm-dwp", compiler.host); + builder.copy(&src_dir.join(&exe), &dst_dir.join(&exe)); + // Man pages t!(fs::create_dir_all(image.join("share/man/man1"))); let man_src = builder.src.join("src/doc/man"); -- cgit 1.4.1-3-g733a5 From 99ad915e32744eb771e9a0968bf7d0d1f52a9a07 Mon Sep 17 00:00:00 2001 From: David Wood Date: Sun, 8 Nov 2020 17:27:33 +0000 Subject: compiletest: add split dwarf compare mode This commit adds a Split DWARF compare mode to compiletest so that debuginfo tests are also tested using Split DWARF in split mode (and manually in single mode). Signed-off-by: David Wood --- compiler/rustc_codegen_ssa/src/back/link.rs | 7 +++++++ src/bootstrap/test.rs | 7 ++++++- src/tools/compiletest/src/common.rs | 6 ++++++ src/tools/compiletest/src/header.rs | 2 ++ src/tools/compiletest/src/runtest.rs | 6 ++++++ 5 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 123d1ae55fb..ccd4d103ddb 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1037,6 +1037,13 @@ fn preserve_objects_for_their_debuginfo(sess: &Session) -> bool { return false; } + // Single mode keeps debuginfo in the same object file, but in such a way that it it skipped + // by the linker - so it's expected that when codegen units are linked together that this + // debuginfo would be lost without keeping around the temps. + if sess.opts.debugging_opts.split_dwarf == config::SplitDwarfKind::Single { + return true; + } + // If we're on OSX then the equivalent of split dwarf is turned on by // default. The final executable won't actually have any debug information // except it'll have pointers to elsewhere. Historically we've always run diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 78b5de7897d..b99692e8ba5 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -897,7 +897,12 @@ default_test!(Incremental { suite: "incremental" }); -default_test!(Debuginfo { path: "src/test/debuginfo", mode: "debuginfo", suite: "debuginfo" }); +default_test_with_compare_mode!(Debuginfo { + path: "src/test/debuginfo", + mode: "debuginfo", + suite: "debuginfo", + compare_mode: "split-dwarf" +}); host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" }); diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 55d25fa7c52..80fbb06b946 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -127,6 +127,8 @@ pub enum CompareMode { Nll, Polonius, Chalk, + SplitDwarf, + SplitDwarfSingle, } impl CompareMode { @@ -135,6 +137,8 @@ impl CompareMode { CompareMode::Nll => "nll", CompareMode::Polonius => "polonius", CompareMode::Chalk => "chalk", + CompareMode::SplitDwarf => "split-dwarf", + CompareMode::SplitDwarfSingle => "split-dwarf-single", } } @@ -143,6 +147,8 @@ impl CompareMode { "nll" => CompareMode::Nll, "polonius" => CompareMode::Polonius, "chalk" => CompareMode::Chalk, + "split-dwarf" => CompareMode::SplitDwarf, + "split-dwarf-single" => CompareMode::SplitDwarfSingle, x => panic!("unknown --compare-mode option: {}", x), } } diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 59f64e7df0f..a1be0a19f68 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -852,6 +852,8 @@ impl Config { Some(CompareMode::Nll) => name == "compare-mode-nll", Some(CompareMode::Polonius) => name == "compare-mode-polonius", Some(CompareMode::Chalk) => name == "compare-mode-chalk", + Some(CompareMode::SplitDwarf) => name == "compare-mode-split-dwarf", + Some(CompareMode::SplitDwarfSingle) => name == "compare-mode-split-dwarf-single", None => false, } || (cfg!(debug_assertions) && name == "debug") || diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7af0d91271b..828c4e89f0b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2017,6 +2017,12 @@ impl<'test> TestCx<'test> { Some(CompareMode::Chalk) => { rustc.args(&["-Zchalk"]); } + Some(CompareMode::SplitDwarf) => { + rustc.args(&["-Zsplit-dwarf=split"]); + } + Some(CompareMode::SplitDwarfSingle) => { + rustc.args(&["-Zsplit-dwarf=single"]); + } None => {} } -- cgit 1.4.1-3-g733a5 From 68932060868cda5b14f8e382d28df09905572176 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 16 Dec 2020 09:10:40 -0800 Subject: Revert "Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum" This reverts commit 7afc5172305cdae588a0318ce545749cf4ed947d, reversing changes made to d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f. --- src/bootstrap/dist.rs | 26 ++------------------------ src/bootstrap/lib.rs | 21 --------------------- 2 files changed, 2 insertions(+), 45 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 25905895116..393715e5561 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1043,30 +1043,6 @@ impl Step for Src { builder.copy(&builder.src.join(file), &dst_src.join(file)); } - // libtest includes std and everything else, so vendoring it - // creates exactly what's needed for `cargo -Zbuild-std` or any - // other analysis of the stdlib's source. Cargo also needs help - // finding the lock, so we copy it to libtest temporarily. - // - // Note that this requires std to only have one version of each - // crate. e.g. two versions of getopts won't be patchable. - let dst_libtest = dst_src.join("library/test"); - let dst_vendor = dst_src.join("vendor"); - let root_lock = dst_src.join("Cargo.lock"); - let temp_lock = dst_libtest.join("Cargo.lock"); - - // `cargo vendor` will delete everything from the lockfile that - // isn't used by libtest, so we need to not use any links! - builder.really_copy(&root_lock, &temp_lock); - - let mut cmd = Command::new(&builder.initial_cargo); - cmd.arg("vendor").arg(dst_vendor).current_dir(&dst_libtest); - builder.info("Dist src"); - let _time = timeit(builder); - builder.run(&mut cmd); - - builder.remove(&temp_lock); - // Create source tarball in rust-installer format let mut cmd = rust_installer(builder); cmd.arg("generate") @@ -1083,6 +1059,8 @@ impl Step for Src { .arg("--component-name=rust-src") .arg("--legacy-manifest-dirs=rustlib,cargo"); + builder.info("Dist src"); + let _time = timeit(builder); builder.run(&mut cmd); builder.remove_dir(&image); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 06ccd72186d..ece9bdc7a64 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1182,27 +1182,6 @@ impl Build { paths } - /// Copies a file from `src` to `dst` and doesn't use links, so - /// that the copy can be modified without affecting the original. - pub fn really_copy(&self, src: &Path, dst: &Path) { - if self.config.dry_run { - return; - } - self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst)); - if src == dst { - return; - } - let _ = fs::remove_file(&dst); - let metadata = t!(src.symlink_metadata()); - if let Err(e) = fs::copy(src, dst) { - panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e) - } - t!(fs::set_permissions(dst, metadata.permissions())); - let atime = FileTime::from_last_access_time(&metadata); - let mtime = FileTime::from_last_modification_time(&metadata); - t!(filetime::set_file_times(dst, atime, mtime)); - } - /// Copies a file from `src` to `dst` pub fn copy(&self, src: &Path, dst: &Path) { if self.config.dry_run { -- cgit 1.4.1-3-g733a5 From 6132e21961be89d1b884dd03af0aef02347328ba Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 16 Dec 2020 19:16:36 +0000 Subject: bootstrap: include llvm-dwp in CI LLVM This commit includes the `llvm-dwp` tool in the CI LLVM (which rustc developers can download instead of building LLVM locally) - `llvm-dwp` is required by Split DWARF which landed in PR #77117. Signed-off-by: David Wood --- src/bootstrap/dist.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 25905895116..b1bb97cf83b 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2553,6 +2553,7 @@ impl Step for RustDev { install_bin("llvm-profdata"); install_bin("llvm-bcanalyzer"); install_bin("llvm-cov"); + install_bin("llvm-dwp"); builder.install(&builder.llvm_filecheck(target), &dst_bindir, 0o755); // Copy the include directory as well; needed mostly to build -- cgit 1.4.1-3-g733a5 From 62eab830c859bc4d3d53032e5b7288c7ea6f0c56 Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 17 Dec 2020 10:29:58 +0000 Subject: bootstrap: update ci-llvm stamp after #80087 Unfortunately, #80087 forgot to update the ci-llvm stamp, so the updated ci-llvm tarball with `llvm-dwp` wasn't downloaded by users. This commit updates the ci-llvm stamp to resolve that problem. Signed-off-by: David Wood --- src/bootstrap/download-ci-llvm-stamp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/download-ci-llvm-stamp b/src/bootstrap/download-ci-llvm-stamp index d857618eefa..b29ecd65401 100644 --- a/src/bootstrap/download-ci-llvm-stamp +++ b/src/bootstrap/download-ci-llvm-stamp @@ -1,4 +1,4 @@ Change this file to make users of the `download-ci-llvm` configuration download a new version of LLVM from CI, even if the LLVM submodule hasn’t changed. -Last change is for: https://github.com/rust-lang/rust/pull/78131 +Last change is for: https://github.com/rust-lang/rust/pull/80087 -- cgit 1.4.1-3-g733a5 From 74498c17e0d7ba29dd33e7765234ea75929b6aa7 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 16 Dec 2020 09:03:33 -0800 Subject: Update cargo --- Cargo.lock | 60 +++++++++++++++++++++++++++++++++++++++++++++++---- Cargo.toml | 3 +++ src/bootstrap/dist.rs | 6 ++++++ src/bootstrap/tool.rs | 37 +++++++++++++++++++++++++++++-- src/tools/cargo | 2 +- 5 files changed, 101 insertions(+), 7 deletions(-) (limited to 'src/bootstrap') diff --git a/Cargo.lock b/Cargo.lock index 9fef7fc1e35..fcfd23f2dae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -355,6 +355,35 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "cargo-credential" +version = "0.1.0" + +[[package]] +name = "cargo-credential-1password" +version = "0.1.0" +dependencies = [ + "cargo-credential", + "serde", + "serde_json", +] + +[[package]] +name = "cargo-credential-macos-keychain" +version = "0.1.0" +dependencies = [ + "cargo-credential", + "security-framework", +] + +[[package]] +name = "cargo-credential-wincred" +version = "0.1.0" +dependencies = [ + "cargo-credential", + "winapi 0.3.9", +] + [[package]] name = "cargo-miri" version = "0.1.0" @@ -4442,6 +4471,29 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "0.9.0" @@ -4489,18 +4541,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.115" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.115" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index e1a36d88086..204c92045b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,9 @@ members = [ "src/tools/rust-installer", "src/tools/rust-demangler", "src/tools/cargo", + "src/tools/cargo/crates/credential/cargo-credential-1password", + "src/tools/cargo/crates/credential/cargo-credential-macos-keychain", + "src/tools/cargo/crates/credential/cargo-credential-wincred", "src/tools/rustdoc", "src/tools/rls", "src/tools/rustfmt", diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 360e51ed2bb..46110b71153 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1247,6 +1247,12 @@ impl Step for Cargo { builder.create_dir(&image.join("etc/bash_completion.d")); let cargo = builder.ensure(tool::Cargo { compiler, target }); builder.install(&cargo, &image.join("bin"), 0o755); + for dirent in fs::read_dir(cargo.parent().unwrap()).expect("read_dir") { + let dirent = dirent.expect("read dir entry"); + if dirent.file_name().to_str().expect("utf8").starts_with("cargo-credential-") { + builder.install(&dirent.path(), &image.join("libexec"), 0o755); + } + } for man in t!(etc.join("man").read_dir()) { let man = t!(man); builder.install(&man.path(), &image.join("share/man/man1"), 0o644); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 290e3744852..dc786249d99 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -563,7 +563,7 @@ impl Step for Cargo { } fn run(self, builder: &Builder<'_>) -> PathBuf { - builder + let cargo_bin_path = builder .ensure(ToolBuild { compiler: self.compiler, target: self.target, @@ -574,7 +574,40 @@ impl Step for Cargo { source_type: SourceType::Submodule, extra_features: Vec::new(), }) - .expect("expected to build -- essential tool") + .expect("expected to build -- essential tool"); + + let build_cred = |name, path| { + // These credential helpers are currently experimental. + // Any build failures will be ignored. + let _ = builder.ensure(ToolBuild { + compiler: self.compiler, + target: self.target, + tool: name, + mode: Mode::ToolRustc, + path, + is_optional_tool: true, + source_type: SourceType::Submodule, + extra_features: Vec::new(), + }); + }; + + if self.target.contains("windows") { + build_cred( + "cargo-credential-wincred", + "src/tools/cargo/crates/credential/cargo-credential-wincred", + ); + } + if self.target.contains("apple-darwin") { + build_cred( + "cargo-credential-macos-keychain", + "src/tools/cargo/crates/credential/cargo-credential-macos-keychain", + ); + } + build_cred( + "cargo-credential-1password", + "src/tools/cargo/crates/credential/cargo-credential-1password", + ); + cargo_bin_path } } diff --git a/src/tools/cargo b/src/tools/cargo index d274fcf862b..a3c2627fbc2 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit d274fcf862b89264fa2c6b917b15230705257317 +Subproject commit a3c2627fbc2f5391c65ba45ab53b81bf71fa323c -- cgit 1.4.1-3-g733a5 From e628fcfcb591ce78673d2736ebe936873ea5111d Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Sun, 20 Dec 2020 02:49:18 +0000 Subject: Skip `dsymutil` by default for compiler bootstrap `dsymutil` adds time to builds on Apple platforms for no clear benefit, and also makes it more difficult for debuggers to find debug info. The compiler currently defaults to running `dsymutil` to preserve its historical default, but when compiling the compiler itself, we skip it by default since we know it's safe to do so in that case. --- config.toml.example | 8 ++++++++ src/bootstrap/builder.rs | 13 +++++++++++++ src/bootstrap/config.rs | 3 +++ 3 files changed, 24 insertions(+) (limited to 'src/bootstrap') diff --git a/config.toml.example b/config.toml.example index 5b045d4e32d..b1fb8904ca9 100644 --- a/config.toml.example +++ b/config.toml.example @@ -426,6 +426,14 @@ changelog-seen = 2 # FIXME(#61117): Some tests fail when this option is enabled. #debuginfo-level-tests = 0 +# Whether to run `dsymutil` on Apple platforms to gather debug info into .dSYM +# bundles. `dsymutil` adds time to builds for no clear benefit, and also makes +# it more difficult for debuggers to find debug info. The compiler currently +# defaults to running `dsymutil` to preserve its historical default, but when +# compiling the compiler itself, we skip it by default since we know it's safe +# to do so in that case. +#run-dsymutil = false + # Whether or not `panic!`s generate backtraces (RUST_BACKTRACE) #backtrace = true diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 9af79e20630..ab0c4a5c31b 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1126,6 +1126,19 @@ impl<'a> Builder<'a> { }, ); + // `dsymutil` adds time to builds on Apple platforms for no clear benefit, and also makes + // it more difficult for debuggers to find debug info. The compiler currently defaults to + // running `dsymutil` to preserve its historical default, but when compiling the compiler + // itself, we skip it by default since we know it's safe to do so in that case. + // See https://github.com/rust-lang/rust/issues/79361 for more info on this flag. + if target.contains("apple") { + if self.config.rust_run_dsymutil { + rustflags.arg("-Zrun-dsymutil=yes"); + } else { + rustflags.arg("-Zrun-dsymutil=no"); + } + } + if self.config.cmd.bless() { // Bless `expect!` tests. cargo.env("UPDATE_EXPECT", "1"); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index fb2c6d1f92a..ece8a7494b5 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -123,6 +123,7 @@ pub struct Config { pub rust_debuginfo_level_std: u32, pub rust_debuginfo_level_tools: u32, pub rust_debuginfo_level_tests: u32, + pub rust_run_dsymutil: bool, pub rust_rpath: bool, pub rustc_parallel: bool, pub rustc_default_linker: Option, @@ -466,6 +467,7 @@ struct Rust { debuginfo_level_std: Option, debuginfo_level_tools: Option, debuginfo_level_tests: Option, + run_dsymutil: Option, backtrace: Option, incremental: Option, parallel_compiler: Option, @@ -830,6 +832,7 @@ impl Config { debuginfo_level_std = rust.debuginfo_level_std; debuginfo_level_tools = rust.debuginfo_level_tools; debuginfo_level_tests = rust.debuginfo_level_tests; + config.rust_run_dsymutil = rust.run_dsymutil.unwrap_or(false); optimize = rust.optimize; ignore_git = rust.ignore_git; set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling); -- cgit 1.4.1-3-g733a5 From fbc9d50d752ab298aea2844d236095b198e96fe6 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 20 Dec 2020 17:16:02 +0000 Subject: make sure installer only creates directories in DESTDIR Fixes #80238 Signed-off-by: Yuxuan Shui --- src/bootstrap/install.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 074f5cd73f3..8f2b128b368 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -73,12 +73,7 @@ fn install_sh( let docdir_default = datadir_default.join("doc/rust"); let libdir_default = PathBuf::from("lib"); let mandir_default = datadir_default.join("man"); - let prefix = builder.config.prefix.as_ref().map_or(prefix_default, |p| { - fs::create_dir_all(p) - .unwrap_or_else(|err| panic!("could not create {}: {}", p.display(), err)); - fs::canonicalize(p) - .unwrap_or_else(|err| panic!("could not canonicalize {}: {}", p.display(), err)) - }); + let prefix = builder.config.prefix.as_ref().unwrap_or(&prefix_default); let sysconfdir = builder.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default); let datadir = builder.config.datadir.as_ref().unwrap_or(&datadir_default); let docdir = builder.config.docdir.as_ref().unwrap_or(&docdir_default); @@ -103,6 +98,13 @@ fn install_sh( let libdir = add_destdir(&libdir, &destdir); let mandir = add_destdir(&mandir, &destdir); + let prefix = { + fs::create_dir_all(&prefix) + .unwrap_or_else(|err| panic!("could not create {}: {}", prefix.display(), err)); + fs::canonicalize(&prefix) + .unwrap_or_else(|err| panic!("could not canonicalize {}: {}", prefix.display(), err)) + }; + let empty_dir = builder.out.join("tmp/empty_dir"); t!(fs::create_dir_all(&empty_dir)); -- cgit 1.4.1-3-g733a5 From a448f88b6986208c0da97940c86189f78a865068 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 14 Dec 2020 13:50:59 -0500 Subject: Utilize PGO for rustc linux dist builds This implements support for applying PGO to the rustc compilation step (not standard library or any tooling, including rustdoc). Expanding PGO to more tools is not terribly difficult but will involve more work and greater CI time commitment. For the same reason of avoiding greater time commitment, this currently avoids implementing for platforms outside of x86_64-unknown-linux-gnu, though in practice it should be quite simple to extend over time to more platforms. The initial implementation is intentionally minimal here to avoid too much work investment before we start seeing wins for a subset of Rust users. The choice of workloads to profile here is somewhat arbitrary, but the general rationale was to aim for a small set that largely avoided time regressions on perf.rust-lang.org's full suite of crates. The set chosen is libcore, cargo (and its dependencies), and a few ad-hoc stress tests from perf.rlo. The stress tests are arguably the most controversial, but they benefit those cases (avoiding regressions) and do not really remove wins from other benchmarks. The primary next step after this PR lands is to implement support for PGO in LLVM. It is unclear whether we can afford a full LLVM rebuild in CI, though, so the approach taken there may need to be more staggered. rustc-only PGO seems well affordable on linux at least, giving us up to 20% wall time wins on some crates for 15 minutes of extra CI time (1 hour up from 45 minutes). The PGO data is uploaded to allow others to reuse it if attempting to reproduce the CI build or potentially, in the future, on other platforms where an off-by-one strategy is used for dist builds at minimal performance cost. --- src/bootstrap/builder.rs | 1 + src/bootstrap/compile.rs | 37 +++++++++++- src/bootstrap/config.rs | 9 +++ src/bootstrap/dist.rs | 69 ++++++++++++++++++++++ src/bootstrap/flags.rs | 7 +++ .../host-x86_64/dist-x86_64-linux/Dockerfile | 9 ++- src/ci/pgo.sh | 47 +++++++++++++++ src/tools/build-manifest/src/main.rs | 1 + 8 files changed, 176 insertions(+), 4 deletions(-) create mode 100755 src/ci/pgo.sh (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 9af79e20630..05b1035d843 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -471,6 +471,7 @@ impl<'a> Builder<'a> { dist::RustDev, dist::Extended, dist::BuildManifest, + dist::ReproducibleArtifacts, ), Kind::Install => describe!( install::Docs, diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index fbebb26c746..091bd2a1c5a 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -501,6 +501,41 @@ impl Step for Rustc { let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "build"); rustc_cargo(builder, &mut cargo, target); + if builder.config.rust_profile_use.is_some() + && builder.config.rust_profile_generate.is_some() + { + panic!("Cannot use and generate PGO profiles at the same time"); + } + + let is_collecting = if let Some(path) = &builder.config.rust_profile_generate { + if compiler.stage == 1 { + cargo.rustflag(&format!("-Cprofile-generate={}", path)); + // Apparently necessary to avoid overflowing the counters during + // a Cargo build profile + cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4"); + true + } else { + false + } + } else if let Some(path) = &builder.config.rust_profile_use { + if compiler.stage == 1 { + cargo.rustflag(&format!("-Cprofile-use={}", path)); + cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function"); + true + } else { + false + } + } else { + false + }; + if is_collecting { + // Ensure paths to Rust sources are relative, not absolute. + cargo.rustflag(&format!( + "-Cllvm-args=-static-func-strip-dirname-prefix={}", + builder.config.src.components().count() + )); + } + builder.info(&format!( "Building stage{} compiler artifacts ({} -> {})", compiler.stage, &compiler.host, target @@ -752,7 +787,7 @@ fn copy_codegen_backends_to_sysroot( // Here we're looking for the output dylib of the `CodegenBackend` step and // we're copying that into the `codegen-backends` folder. let dst = builder.sysroot_codegen_backends(target_compiler); - t!(fs::create_dir_all(&dst)); + t!(fs::create_dir_all(&dst), dst); if builder.config.dry_run { return; diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index fb2c6d1f92a..58dc5f7af79 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -133,6 +133,8 @@ pub struct Config { pub rust_thin_lto_import_instr_limit: Option, pub rust_remap_debuginfo: bool, pub rust_new_symbol_mangling: bool, + pub rust_profile_use: Option, + pub rust_profile_generate: Option, pub build: TargetSelection, pub hosts: Vec, @@ -494,6 +496,8 @@ struct Rust { llvm_libunwind: Option, control_flow_guard: Option, new_symbol_mangling: Option, + profile_generate: Option, + profile_use: Option, } /// TOML representation of how each build target is configured. @@ -871,6 +875,11 @@ impl Config { config.rust_codegen_units = rust.codegen_units.map(threads_from_config); config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config); + config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use); + config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate); + } else { + config.rust_profile_use = flags.rust_profile_use; + config.rust_profile_generate = flags.rust_profile_generate; } if let Some(t) = toml.target { diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index b1bb97cf83b..823f62fa4a3 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2664,3 +2664,72 @@ impl Step for BuildManifest { distdir(builder).join(format!("{}-{}.tar.gz", name, self.target.triple)) } } + +/// Tarball containing artifacts necessary to reproduce the build of rustc. +/// +/// Currently this is the PGO profile data. +/// +/// Should not be considered stable by end users. +#[derive(Clone, Debug, Eq, Hash, PartialEq)] +pub struct ReproducibleArtifacts { + pub target: TargetSelection, +} + +impl Step for ReproducibleArtifacts { + type Output = Option; + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("reproducible") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(ReproducibleArtifacts { target: run.target }); + } + + fn run(self, builder: &Builder<'_>) -> Self::Output { + let name = pkgname(builder, "reproducible-artifacts"); + let tmp = tmpdir(builder); + + // Prepare the image. + let image = tmp.join("reproducible-artifacts-image"); + let _ = fs::remove_dir_all(&image); + + if let Some(path) = &builder.config.rust_profile_use { + builder.install(std::path::Path::new(path), &image, 0o644); + } else { + return None; + } + + // Prepare the overlay. + let overlay = tmp.join("reproducible-artifacts-overlay"); + let _ = fs::remove_dir_all(&overlay); + builder.create_dir(&overlay); + builder.create(&overlay.join("version"), &builder.rust_version()); + for file in &["COPYRIGHT", "LICENSE-APACHE", "LICENSE-MIT", "README.md"] { + builder.install(&builder.src.join(file), &overlay, 0o644); + } + + // Create the final tarball. + let mut cmd = rust_installer(builder); + cmd.arg("generate") + .arg("--product-name=Rust") + .arg("--rel-manifest-dir=rustlib") + .arg("--success-message=reproducible-artifacts installed.") + .arg("--image-dir") + .arg(&image) + .arg("--work-dir") + .arg(&tmpdir(builder)) + .arg("--output-dir") + .arg(&distdir(builder)) + .arg("--non-installed-overlay") + .arg(&overlay) + .arg(format!("--package-name={}-{}", name, self.target.triple)) + .arg("--legacy-manifest-dirs=rustlib,cargo") + .arg("--component-name=reproducible-artifacts"); + + builder.run(&mut cmd); + Some(distdir(builder).join(format!("{}-{}.tar.gz", name, self.target.triple))) + } +} diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 5a8096674c6..d6a45f1c170 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -68,6 +68,9 @@ pub struct Flags { pub deny_warnings: Option, pub llvm_skip_rebuild: Option, + + pub rust_profile_use: Option, + pub rust_profile_generate: Option, } pub enum Subcommand { @@ -219,6 +222,8 @@ To learn more about a subcommand, run `./x.py -h`", VALUE overrides the skip-rebuild option in config.toml.", "VALUE", ); + opts.optopt("", "rust-profile-generate", "rustc error format", "FORMAT"); + opts.optopt("", "rust-profile-use", "rustc error format", "FORMAT"); // We can't use getopt to parse the options until we have completed specifying which // options are valid, but under the current implementation, some options are conditional on @@ -674,6 +679,8 @@ Arguments: color: matches .opt_get_default("color", Color::Auto) .expect("`color` should be `always`, `never`, or `auto`"), + rust_profile_use: matches.opt_str("rust-profile-use"), + rust_profile_generate: matches.opt_str("rust-profile-generate"), } } } diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile index 14700aeea05..d1b4bbf7fff 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile @@ -85,6 +85,8 @@ ENV CC=clang CXX=clang++ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +ENV PGO_HOST=x86_64-unknown-linux-gnu + ENV HOSTS=x86_64-unknown-linux-gnu ENV RUST_CONFIGURE_ARGS \ @@ -98,9 +100,10 @@ ENV RUST_CONFIGURE_ARGS \ --set llvm.thin-lto=true \ --set llvm.ninja=false \ --set rust.jemalloc -ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS \ - --include-default-paths \ - src/tools/build-manifest +ENV SCRIPT ../src/ci/pgo.sh python2.7 ../x.py dist \ + --host $HOSTS --target $HOSTS \ + --include-default-paths \ + src/tools/build-manifest ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang # This is the only builder which will create source tarballs diff --git a/src/ci/pgo.sh b/src/ci/pgo.sh new file mode 100755 index 00000000000..13b8ca91f89 --- /dev/null +++ b/src/ci/pgo.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +set -euxo pipefail + +rm -rf /tmp/rustc-pgo + +python2.7 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \ + --stage 2 library/std --rust-profile-generate=/tmp/rustc-pgo + +./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \ + --crate-type=lib ../library/core/src/lib.rs + +# Download and build a single-file stress test benchmark on perf.rust-lang.org. +function pgo_perf_benchmark { + local PERF=e095f5021bf01cf3800f50b3a9f14a9683eb3e4e + local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF + local name=$1 + curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs + ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 --crate-type=lib /tmp/$name.rs +} + +pgo_perf_benchmark externs +pgo_perf_benchmark ctfe-stress-4 + +cp -pri ../src/tools/cargo /tmp/cargo + +# Build cargo (with some flags) +function pgo_cargo { + RUSTC=./build/$PGO_HOST/stage2/bin/rustc \ + ./build/$PGO_HOST/stage0/bin/cargo $@ \ + --manifest-path /tmp/cargo/Cargo.toml +} + +# Build a couple different variants of Cargo +CARGO_INCREMENTAL=1 pgo_cargo check +echo 'pub fn barbarbar() {}' >> /tmp/cargo/src/cargo/lib.rs +CARGO_INCREMENTAL=1 pgo_cargo check +touch /tmp/cargo/src/cargo/lib.rs +CARGO_INCREMENTAL=1 pgo_cargo check +pgo_cargo build --release + +# Merge the profile data we gathered +./build/$PGO_HOST/llvm/bin/llvm-profdata \ + merge -o /tmp/rustc-pgo.profdata /tmp/rustc-pgo + +# This produces the actual final set of artifacts. +$@ --rust-profile-use=/tmp/rustc-pgo.profdata diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 0462efaa9b0..73a4cbd0792 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -299,6 +299,7 @@ impl Builder { let mut package = |name, targets| self.package(name, &mut manifest.pkg, targets); package("rustc", HOSTS); package("rustc-dev", HOSTS); + package("reproducible-artifacts", HOSTS); package("rustc-docs", HOSTS); package("cargo", HOSTS); package("rust-mingw", MINGW); -- cgit 1.4.1-3-g733a5 From 32716814a2d9a26674503122d0b91aca39e5ab28 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Wed, 23 Dec 2020 00:00:00 +0000 Subject: Ignore proc-macros when assembling rustc libdir --- src/bootstrap/compile.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index fbebb26c746..81a5b4c8960 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -7,6 +7,7 @@ //! goes along from the output of the previous stage. use std::borrow::Cow; +use std::collections::HashSet; use std::env; use std::fs; use std::io::prelude::*; @@ -956,13 +957,26 @@ impl Step for Assemble { builder.info(&format!("Assembling stage{} compiler ({})", stage, host)); // Link in all dylibs to the libdir + let stamp = librustc_stamp(builder, build_compiler, target_compiler.host); + let proc_macros = builder + .read_stamp_file(&stamp) + .into_iter() + .filter_map(|(path, dependency_type)| { + if dependency_type == DependencyType::Host { + Some(path.file_name().unwrap().to_owned().into_string().unwrap()) + } else { + None + } + }) + .collect::>(); + let sysroot = builder.sysroot(target_compiler); let rustc_libdir = builder.rustc_libdir(target_compiler); t!(fs::create_dir_all(&rustc_libdir)); let src_libdir = builder.sysroot_libdir(build_compiler, host); for f in builder.read_dir(&src_libdir) { let filename = f.file_name().into_string().unwrap(); - if is_dylib(&filename) { + if is_dylib(&filename) && !proc_macros.contains(&filename) { builder.copy(&f.path(), &rustc_libdir.join(&filename)); } } -- cgit 1.4.1-3-g733a5 From a6d377d56560350976ccb46f33ae14ad65eb9372 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 22 Dec 2020 16:33:36 -0800 Subject: Include rustdoc in the compiler docs index. --- src/bootstrap/doc.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 8cacc2512ef..30a8229036f 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -628,6 +628,8 @@ impl Step for Rustdoc { cargo.arg("-p").arg("rustdoc"); cargo.rustdocflag("--document-private-items"); + cargo.rustdocflag("--enable-index-page"); + cargo.rustdocflag("-Zunstable-options"); builder.run(&mut cargo.into()); } } -- cgit 1.4.1-3-g733a5 From ddf82636c6b2d42a1fe9d25b51ec9b006043f529 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 16:52:20 +0100 Subject: bootstrap: convert build-manifest to use the new Tarball struct --- src/bootstrap/dist.rs | 109 ++++++++--------------------------------- src/bootstrap/lib.rs | 1 + src/bootstrap/tarball.rs | 124 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 88 deletions(-) create mode 100644 src/bootstrap/tarball.rs (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index fcbde9c438c..0ec896ed211 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -19,6 +19,7 @@ use crate::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::cache::{Interned, INTERNER}; use crate::compile; use crate::config::TargetSelection; +use crate::tarball::{OverlayKind, Tarball}; use crate::tool::{self, Tool}; use crate::util::{exe, is_dylib, timeit}; use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS}; @@ -2517,68 +2518,36 @@ impl Step for RustDev { builder.info(&format!("Dist RustDev ({})", target)); let _time = timeit(builder); - let src = builder.src.join("src/llvm-project/llvm"); - let name = pkgname(builder, "rust-dev"); - - let tmp = tmpdir(builder); - let image = tmp.join("rust-dev-image"); - drop(fs::remove_dir_all(&image)); - // Prepare the image directory - let dst_bindir = image.join("bin"); - t!(fs::create_dir_all(&dst_bindir)); + let mut tarball = Tarball::new(builder, "rust-dev", &target.triple); + tarball.set_overlay(OverlayKind::LLVM); let src_bindir = builder.llvm_out(target).join("bin"); - let install_bin = - |name| builder.install(&src_bindir.join(exe(name, target)), &dst_bindir, 0o755); - install_bin("llvm-config"); - install_bin("llvm-ar"); - install_bin("llvm-objdump"); - install_bin("llvm-profdata"); - install_bin("llvm-bcanalyzer"); - install_bin("llvm-cov"); - install_bin("llvm-dwp"); - builder.install(&builder.llvm_filecheck(target), &dst_bindir, 0o755); + for bin in &[ + "llvm-config", + "llvm-ar", + "llvm-objdump", + "llvm-profdata", + "llvm-bcanalyzer", + "llvm-cov", + "llvm-dwp", + ] { + tarball.add_file(src_bindir.join(exe(bin, target)), "bin", 0o755); + } + tarball.add_file(&builder.llvm_filecheck(target), "bin", 0o755); // Copy the include directory as well; needed mostly to build // librustc_llvm properly (e.g., llvm-config.h is in here). But also // just broadly useful to be able to link against the bundled LLVM. - builder.cp_r(&builder.llvm_out(target).join("include"), &image.join("include")); + tarball.add_dir(&builder.llvm_out(target).join("include"), "."); // Copy libLLVM.so to the target lib dir as well, so the RPATH like // `$ORIGIN/../lib` can find it. It may also be used as a dependency // of `rustc-dev` to support the inherited `-lLLVM` when using the // compiler libraries. - maybe_install_llvm(builder, target, &image.join("lib")); - - // Prepare the overlay - let overlay = tmp.join("rust-dev-overlay"); - drop(fs::remove_dir_all(&overlay)); - builder.create_dir(&overlay); - builder.install(&src.join("README.txt"), &overlay, 0o644); - builder.install(&src.join("LICENSE.TXT"), &overlay, 0o644); - builder.create(&overlay.join("version"), &builder.rust_version()); + maybe_install_llvm(builder, target, &tarball.image_dir().join("lib")); - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=rust-dev-installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=rust-dev"); - - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))) + Some(tarball.generate()) } } @@ -2607,45 +2576,9 @@ impl Step for BuildManifest { fn run(self, builder: &Builder<'_>) -> PathBuf { let build_manifest = builder.tool_exe(Tool::BuildManifest); - let name = pkgname(builder, "build-manifest"); - let tmp = tmpdir(builder); - - // Prepare the image. - let image = tmp.join("build-manifest-image"); - let image_bin = image.join("bin"); - let _ = fs::remove_dir_all(&image); - t!(fs::create_dir_all(&image_bin)); - builder.install(&build_manifest, &image_bin, 0o755); - - // Prepare the overlay. - let overlay = tmp.join("build-manifest-overlay"); - let _ = fs::remove_dir_all(&overlay); - builder.create_dir(&overlay); - builder.create(&overlay.join("version"), &builder.rust_version()); - for file in &["COPYRIGHT", "LICENSE-APACHE", "LICENSE-MIT", "README.md"] { - builder.install(&builder.src.join(file), &overlay, 0o644); - } - - // Create the final tarball. - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=build-manifest installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, self.target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=build-manifest"); - - builder.run(&mut cmd); - distdir(builder).join(format!("{}-{}.tar.gz", name, self.target.triple)) + let tarball = Tarball::new(builder, "build-manifest", &self.target.triple); + tarball.add_file(&build_manifest, "bin", 0o755); + tarball.generate() } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index ece9bdc7a64..3b51bf272fc 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -142,6 +142,7 @@ mod native; mod run; mod sanity; mod setup; +mod tarball; mod test; mod tool; mod toolstate; diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs new file mode 100644 index 00000000000..728d1344349 --- /dev/null +++ b/src/bootstrap/tarball.rs @@ -0,0 +1,124 @@ +use std::path::{Path, PathBuf}; + +use build_helper::t; + +use crate::builder::Builder; + +#[derive(Copy, Clone)] +pub(crate) enum OverlayKind { + Rust, + LLVM, +} + +impl OverlayKind { + fn included_files(&self) -> &[&str] { + match self { + OverlayKind::Rust => &["COPYRIGHT", "LICENSE-APACHE", "LICENSE-MIT", "README.md"], + OverlayKind::LLVM => { + &["src/llvm-project/llvm/LICENSE.TXT", "src/llvm-project/llvm/README.txt"] + } + } + } +} + +pub(crate) struct Tarball<'a> { + builder: &'a Builder<'a>, + + pkgname: String, + component: String, + target: String, + overlay: OverlayKind, + + temp_dir: PathBuf, + image_dir: PathBuf, + overlay_dir: PathBuf, + work_dir: PathBuf, +} + +impl<'a> Tarball<'a> { + pub(crate) fn new(builder: &'a Builder<'a>, component: &str, target: &str) -> Self { + let pkgname = crate::dist::pkgname(builder, component); + + let temp_dir = builder.out.join("tmp").join("tarball").join(component); + let _ = std::fs::remove_dir_all(&temp_dir); + + let image_dir = temp_dir.join("image"); + let overlay_dir = temp_dir.join("overlay"); + let work_dir = temp_dir.join("work"); + + Self { + builder, + + pkgname, + component: component.into(), + target: target.into(), + overlay: OverlayKind::Rust, + + temp_dir, + image_dir, + overlay_dir, + work_dir, + } + } + + pub(crate) fn set_overlay(&mut self, overlay: OverlayKind) { + self.overlay = overlay; + } + + pub(crate) fn image_dir(&self) -> &Path { + t!(std::fs::create_dir_all(&self.image_dir)); + &self.image_dir + } + + pub(crate) fn add_file(&self, src: impl AsRef, destdir: impl AsRef, perms: u32) { + // create_dir_all fails to create `foo/bar/.`, so when the destination is "." this simply + // uses the base directory as the destination directory. + let destdir = if destdir.as_ref() == Path::new(".") { + self.image_dir.clone() + } else { + self.image_dir.join(destdir.as_ref()) + }; + + t!(std::fs::create_dir_all(&destdir)); + self.builder.install(src.as_ref(), &destdir, perms); + } + + pub(crate) fn add_dir(&self, src: impl AsRef, destdir: impl AsRef) { + t!(std::fs::create_dir_all(destdir.as_ref())); + self.builder.cp_r( + src.as_ref(), + &self.image_dir.join(destdir.as_ref()).join(src.as_ref().file_name().unwrap()), + ); + } + + pub(crate) fn generate(self) -> PathBuf { + t!(std::fs::create_dir_all(&self.overlay_dir)); + self.builder.create(&self.overlay_dir.join("version"), &self.builder.rust_version()); + for file in self.overlay.included_files() { + self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644); + } + + let distdir = crate::dist::distdir(self.builder); + let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); + cmd.arg("generate") + .arg("--product-name=Rust") + .arg("--rel-manifest-dir=rustlib") + .arg(format!("--success-message={} installed.", self.component)) + .arg("--image-dir") + .arg(self.image_dir) + .arg("--work-dir") + .arg(self.work_dir) + .arg("--output-dir") + .arg(&distdir) + .arg("--non-installed-overlay") + .arg(self.overlay_dir) + .arg(format!("--package-name={}-{}", self.pkgname, self.target)) + .arg("--legacy-manifest-dirs=rustlib,cargo") + .arg(format!("--component-name={}", self.component)); + self.builder.run(&mut cmd); + + t!(std::fs::remove_dir_all(&self.temp_dir)); + + distdir.join(format!("{}-{}.tar.gz", self.pkgname, self.target)) + } +} -- cgit 1.4.1-3-g733a5 From 7be85701cda29bbe715e462be856a61aed5bd4b4 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 17:47:48 +0100 Subject: bootstrap: convert llvm-tools to use Tarball --- src/bootstrap/dist.rs | 44 +++++++------------------------------------- src/bootstrap/lib.rs | 4 ---- src/bootstrap/tarball.rs | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 42 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 0ec896ed211..9b0a6e6e19d 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2431,56 +2431,26 @@ impl Step for LlvmTools { builder.info(&format!("Dist LlvmTools ({})", target)); let _time = timeit(builder); - let src = builder.src.join("src/llvm-project/llvm"); - let name = pkgname(builder, "llvm-tools"); - let tmp = tmpdir(builder); - let image = tmp.join("llvm-tools-image"); - drop(fs::remove_dir_all(&image)); + let mut tarball = Tarball::new(builder, "llvm-tools", &target.triple); + tarball.set_overlay(OverlayKind::LLVM); + tarball.is_preview(true); // Prepare the image directory let src_bindir = builder.llvm_out(target).join("bin"); - let dst_bindir = image.join("lib/rustlib").join(&*target.triple).join("bin"); - t!(fs::create_dir_all(&dst_bindir)); + let dst_bindir = format!("lib/rustlib/{}/bin", target.triple); for tool in LLVM_TOOLS { let exe = src_bindir.join(exe(tool, target)); - builder.install(&exe, &dst_bindir, 0o755); + tarball.add_file(&exe, &dst_bindir, 0o755); } // Copy libLLVM.so to the target lib dir as well, so the RPATH like // `$ORIGIN/../lib` can find it. It may also be used as a dependency // of `rustc-dev` to support the inherited `-lLLVM` when using the // compiler libraries. - maybe_install_llvm_target(builder, target, &image); - - // Prepare the overlay - let overlay = tmp.join("llvm-tools-overlay"); - drop(fs::remove_dir_all(&overlay)); - builder.create_dir(&overlay); - builder.install(&src.join("README.txt"), &overlay, 0o644); - builder.install(&src.join("LICENSE.TXT"), &overlay, 0o644); - builder.create(&overlay.join("version"), &builder.llvm_tools_vers()); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=llvm-tools-installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=llvm-tools-preview"); + maybe_install_llvm_target(builder, target, tarball.image_dir()); - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))) + Some(tarball.generate()) } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 3b51bf272fc..a47ddfbcc1f 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1069,10 +1069,6 @@ impl Build { self.package_vers(&self.version) } - fn llvm_tools_vers(&self) -> String { - self.rust_version() - } - fn llvm_link_tools_dynamically(&self, target: TargetSelection) -> bool { target.contains("linux-gnu") || target.contains("apple-darwin") } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 728d1344349..2c110a7fb24 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -33,6 +33,8 @@ pub(crate) struct Tarball<'a> { image_dir: PathBuf, overlay_dir: PathBuf, work_dir: PathBuf, + + is_preview: bool, } impl<'a> Tarball<'a> { @@ -58,6 +60,8 @@ impl<'a> Tarball<'a> { image_dir, overlay_dir, work_dir, + + is_preview: false, } } @@ -65,6 +69,10 @@ impl<'a> Tarball<'a> { self.overlay = overlay; } + pub(crate) fn is_preview(&mut self, is: bool) { + self.is_preview = is; + } + pub(crate) fn image_dir(&self) -> &Path { t!(std::fs::create_dir_all(&self.image_dir)); &self.image_dir @@ -98,6 +106,11 @@ impl<'a> Tarball<'a> { self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644); } + let mut component_name = self.component.clone(); + if self.is_preview { + component_name.push_str("-preview"); + } + let distdir = crate::dist::distdir(self.builder); let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); cmd.arg("generate") @@ -114,7 +127,7 @@ impl<'a> Tarball<'a> { .arg(self.overlay_dir) .arg(format!("--package-name={}-{}", self.pkgname, self.target)) .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg(format!("--component-name={}", self.component)); + .arg(format!("--component-name={}", component_name)); self.builder.run(&mut cmd); t!(std::fs::remove_dir_all(&self.temp_dir)); -- cgit 1.4.1-3-g733a5 From c768ce138427b1844c1f6594daba9c0e33928032 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 22:20:45 +0100 Subject: bootstrap: convert rust-docs to use Tarball --- src/bootstrap/dist.rs | 45 +++++++++++---------------------------------- src/bootstrap/tarball.rs | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 41 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9b0a6e6e19d..26a621c41ca 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -55,7 +55,7 @@ pub struct Docs { } impl Step for Docs { - type Output = PathBuf; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -67,13 +67,10 @@ impl Step for Docs { } /// Builds the `rust-docs` installer component. - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; - - let name = pkgname(builder, "rust-docs"); - if !builder.config.docs { - return distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple)); + return None; } builder.default_doc(None); @@ -81,34 +78,14 @@ impl Step for Docs { builder.info(&format!("Dist docs ({})", host)); let _time = timeit(builder); - let image = tmpdir(builder).join(format!("{}-{}-image", name, host.triple)); - let _ = fs::remove_dir_all(&image); + let dest = "share/doc/rust/html"; - let dst = image.join("share/doc/rust/html"); - t!(fs::create_dir_all(&dst)); - let src = builder.doc_out(host); - builder.cp_r(&src, &dst); - builder.install(&builder.src.join("src/doc/robots.txt"), &dst, 0o644); - - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust-Documentation") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rust-documentation-is-installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", name, host.triple)) - .arg("--component-name=rust-docs") - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--bulk-dirs=share/doc/rust/html"); - builder.run(&mut cmd); - builder.remove_dir(&image); + let mut tarball = Tarball::new(builder, "rust-docs", &host.triple); + tarball.set_product_name("Rust Documentation"); + tarball.add_dir(&builder.doc_out(host), dest); + tarball.add_file(&builder.src.join("src/doc/robots.txt"), dest, 0o644); - distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple)) + Some(tarball.generate()) } } @@ -1826,7 +1803,7 @@ impl Step for Extended { tarballs.extend(llvm_tools_installer); tarballs.push(analysis_installer); tarballs.push(std_installer); - if builder.config.docs { + if let Some(docs_installer) = docs_installer { tarballs.push(docs_installer); } if target.contains("pc-windows-gnu") { @@ -2509,7 +2486,7 @@ impl Step for RustDev { // Copy the include directory as well; needed mostly to build // librustc_llvm properly (e.g., llvm-config.h is in here). But also // just broadly useful to be able to link against the bundled LLVM. - tarball.add_dir(&builder.llvm_out(target).join("include"), "."); + tarball.add_dir(&builder.llvm_out(target).join("include"), "include"); // Copy libLLVM.so to the target lib dir as well, so the RPATH like // `$ORIGIN/../lib` can find it. It may also be used as a dependency diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 2c110a7fb24..50d58d00a66 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -27,6 +27,7 @@ pub(crate) struct Tarball<'a> { pkgname: String, component: String, target: String, + product_name: String, overlay: OverlayKind, temp_dir: PathBuf, @@ -54,6 +55,7 @@ impl<'a> Tarball<'a> { pkgname, component: component.into(), target: target.into(), + product_name: "Rust".into(), overlay: OverlayKind::Rust, temp_dir, @@ -69,6 +71,10 @@ impl<'a> Tarball<'a> { self.overlay = overlay; } + pub(crate) fn set_product_name(&mut self, name: &str) { + self.product_name = name.into(); + } + pub(crate) fn is_preview(&mut self, is: bool) { self.is_preview = is; } @@ -91,12 +97,11 @@ impl<'a> Tarball<'a> { self.builder.install(src.as_ref(), &destdir, perms); } - pub(crate) fn add_dir(&self, src: impl AsRef, destdir: impl AsRef) { - t!(std::fs::create_dir_all(destdir.as_ref())); - self.builder.cp_r( - src.as_ref(), - &self.image_dir.join(destdir.as_ref()).join(src.as_ref().file_name().unwrap()), - ); + pub(crate) fn add_dir(&self, src: impl AsRef, dest: impl AsRef) { + let dest = self.image_dir.join(dest.as_ref()); + + t!(std::fs::create_dir_all(&dest)); + self.builder.cp_r(src.as_ref(), &dest); } pub(crate) fn generate(self) -> PathBuf { @@ -114,7 +119,7 @@ impl<'a> Tarball<'a> { let distdir = crate::dist::distdir(self.builder); let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); cmd.arg("generate") - .arg("--product-name=Rust") + .arg(format!("--product-name={}", self.product_name)) .arg("--rel-manifest-dir=rustlib") .arg(format!("--success-message={} installed.", self.component)) .arg("--image-dir") -- cgit 1.4.1-3-g733a5 From 8ca46fc7a83734c9622f11f25d16b82316f44bcc Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 22:24:34 +0100 Subject: bootstrap: convert rustc-docs to use Tarball --- src/bootstrap/dist.rs | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 26a621c41ca..5a9c82c52a6 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -95,7 +95,7 @@ pub struct RustcDocs { } impl Step for RustcDocs { - type Output = PathBuf; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -107,47 +107,21 @@ impl Step for RustcDocs { } /// Builds the `rustc-docs` installer component. - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; - - let name = pkgname(builder, "rustc-docs"); - if !builder.config.compiler_docs { - return distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple)); + return None; } builder.default_doc(None); - - let image = tmpdir(builder).join(format!("{}-{}-image", name, host.triple)); - let _ = fs::remove_dir_all(&image); - - let dst = image.join("share/doc/rust/html/rustc"); - t!(fs::create_dir_all(&dst)); - let src = builder.compiler_doc_out(host); - builder.cp_r(&src, &dst); - - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rustc-Documentation") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rustc-documentation-is-installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", name, host.triple)) - .arg("--component-name=rustc-docs") - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--bulk-dirs=share/doc/rust/html/rustc"); - builder.info(&format!("Dist compiler docs ({})", host)); let _time = timeit(builder); - builder.run(&mut cmd); - builder.remove_dir(&image); - distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple)) + let mut tarball = Tarball::new(builder, "rustc-docs", &host.triple); + tarball.set_product_name("Rustc Documentation"); + tarball.add_dir(&builder.compiler_doc_out(host), "share/doc/rust/html/rustc"); + + Some(tarball.generate()) } } -- cgit 1.4.1-3-g733a5 From 82d9eaa54d3a60edc2dd664355e390ec9aa36fa5 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 22:29:33 +0100 Subject: bootstrap: convert rust-mingw to use Tarball --- src/bootstrap/dist.rs | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 5a9c82c52a6..cee8c411fa1 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -297,41 +297,23 @@ impl Step for Mingw { /// without any extra installed software (e.g., we bundle gcc, libraries, etc). fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; - if !host.contains("pc-windows-gnu") { return None; } builder.info(&format!("Dist mingw ({})", host)); let _time = timeit(builder); - let name = pkgname(builder, "rust-mingw"); - let image = tmpdir(builder).join(format!("{}-{}-image", name, host.triple)); - let _ = fs::remove_dir_all(&image); - t!(fs::create_dir_all(&image)); + + let mut tarball = Tarball::new(builder, "rust-mingw", &host.triple); + tarball.set_product_name("Rust MinGW"); // The first argument is a "temporary directory" which is just // thrown away (this contains the runtime DLLs included in the rustc package // above) and the second argument is where to place all the MinGW components // (which is what we want). - make_win_dist(&tmpdir(builder), &image, host, &builder); + make_win_dist(&tmpdir(builder), tarball.image_dir(), host, &builder); - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust-MinGW") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rust-MinGW-is-installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", name, host.triple)) - .arg("--component-name=rust-mingw") - .arg("--legacy-manifest-dirs=rustlib,cargo"); - builder.run(&mut cmd); - t!(fs::remove_dir_all(&image)); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple))) + Some(tarball.generate()) } } -- cgit 1.4.1-3-g733a5 From 0a2e1c5a2c85ff27f2677aa7db1c2deacf34242d Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 22:42:52 +0100 Subject: bootstrap: convert rustc to use Tarball --- src/bootstrap/dist.rs | 60 +++++++----------------------------------------- src/bootstrap/tarball.rs | 3 +++ 2 files changed, 11 insertions(+), 52 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index cee8c411fa1..db792886c16 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -341,30 +341,13 @@ impl Step for Rustc { let compiler = self.compiler; let host = self.compiler.host; - let name = pkgname(builder, "rustc"); - let image = tmpdir(builder).join(format!("{}-{}-image", name, host.triple)); - let _ = fs::remove_dir_all(&image); - let overlay = tmpdir(builder).join(format!("{}-{}-overlay", name, host.triple)); - let _ = fs::remove_dir_all(&overlay); + builder.info(&format!("Dist rustc stage{} ({})", compiler.stage, host.triple)); + let _time = timeit(builder); - // Prepare the rustc "image", what will actually end up getting installed - prepare_image(builder, compiler, &image); + let tarball = Tarball::new(builder, "rustc", &host.triple); - // Prepare the overlay which is part of the tarball but won't actually be - // installed - let cp = |file: &str| { - builder.install(&builder.src.join(file), &overlay, 0o644); - }; - cp("COPYRIGHT"); - cp("LICENSE-APACHE"); - cp("LICENSE-MIT"); - cp("README.md"); - // tiny morsel of metadata is used by rust-packaging - let version = builder.rust_version(); - builder.create(&overlay.join("version"), &version); - if let Some(sha) = builder.rust_sha() { - builder.create(&overlay.join("git-commit-hash"), &sha); - } + // Prepare the rustc "image", what will actually end up getting installed + prepare_image(builder, compiler, tarball.image_dir()); // On MinGW we've got a few runtime DLL dependencies that we need to // include. The first argument to this script is where to put these DLLs @@ -377,38 +360,11 @@ impl Step for Rustc { // install will *also* include the rust-mingw package, which also needs // licenses, so to be safe we just include it here in all MinGW packages. if host.contains("pc-windows-gnu") { - make_win_dist(&image, &tmpdir(builder), host, builder); - - let dst = image.join("share/doc"); - t!(fs::create_dir_all(&dst)); - builder.cp_r(&builder.src.join("src/etc/third-party"), &dst); + make_win_dist(tarball.image_dir(), &tmpdir(builder), host, builder); + tarball.add_dir(builder.src.join("src/etc/third-party"), "share/doc"); } - // Finally, wrap everything up in a nice tarball! - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rust-is-ready-to-roll.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, host.triple)) - .arg("--component-name=rustc") - .arg("--legacy-manifest-dirs=rustlib,cargo"); - - builder.info(&format!("Dist rustc stage{} ({})", compiler.stage, host.triple)); - let _time = timeit(builder); - builder.run(&mut cmd); - builder.remove_dir(&image); - builder.remove_dir(&overlay); - - return distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple)); + return tarball.generate(); fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) { let host = compiler.host; diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 50d58d00a66..294b69c85f4 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -107,6 +107,9 @@ impl<'a> Tarball<'a> { pub(crate) fn generate(self) -> PathBuf { t!(std::fs::create_dir_all(&self.overlay_dir)); self.builder.create(&self.overlay_dir.join("version"), &self.builder.rust_version()); + if let Some(sha) = self.builder.rust_sha() { + self.builder.create(&self.overlay_dir.join("git-commit-hash"), &sha); + } for file in self.overlay.included_files() { self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644); } -- cgit 1.4.1-3-g733a5 From fd4515cb3f8a8e21d3640ffa8f2b3040a381b87c Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 22:50:38 +0100 Subject: bootstrap: refactor showing the "dist" info --- src/bootstrap/dist.rs | 21 --------------------- src/bootstrap/tarball.rs | 7 +++++-- 2 files changed, 5 insertions(+), 23 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index db792886c16..0e00649fc03 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -72,19 +72,14 @@ impl Step for Docs { if !builder.config.docs { return None; } - builder.default_doc(None); - builder.info(&format!("Dist docs ({})", host)); - let _time = timeit(builder); - let dest = "share/doc/rust/html"; let mut tarball = Tarball::new(builder, "rust-docs", &host.triple); tarball.set_product_name("Rust Documentation"); tarball.add_dir(&builder.doc_out(host), dest); tarball.add_file(&builder.src.join("src/doc/robots.txt"), dest, 0o644); - Some(tarball.generate()) } } @@ -112,15 +107,11 @@ impl Step for RustcDocs { if !builder.config.compiler_docs { return None; } - builder.default_doc(None); - builder.info(&format!("Dist compiler docs ({})", host)); - let _time = timeit(builder); let mut tarball = Tarball::new(builder, "rustc-docs", &host.triple); tarball.set_product_name("Rustc Documentation"); tarball.add_dir(&builder.compiler_doc_out(host), "share/doc/rust/html/rustc"); - Some(tarball.generate()) } } @@ -301,9 +292,6 @@ impl Step for Mingw { return None; } - builder.info(&format!("Dist mingw ({})", host)); - let _time = timeit(builder); - let mut tarball = Tarball::new(builder, "rust-mingw", &host.triple); tarball.set_product_name("Rust MinGW"); @@ -341,9 +329,6 @@ impl Step for Rustc { let compiler = self.compiler; let host = self.compiler.host; - builder.info(&format!("Dist rustc stage{} ({})", compiler.stage, host.triple)); - let _time = timeit(builder); - let tarball = Tarball::new(builder, "rustc", &host.triple); // Prepare the rustc "image", what will actually end up getting installed @@ -2318,9 +2303,6 @@ impl Step for LlvmTools { } } - builder.info(&format!("Dist LlvmTools ({})", target)); - let _time = timeit(builder); - let mut tarball = Tarball::new(builder, "llvm-tools", &target.triple); tarball.set_overlay(OverlayKind::LLVM); tarball.is_preview(true); @@ -2375,9 +2357,6 @@ impl Step for RustDev { } } - builder.info(&format!("Dist RustDev ({})", target)); - let _time = timeit(builder); - let mut tarball = Tarball::new(builder, "rust-dev", &target.triple); tarball.set_overlay(OverlayKind::LLVM); diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 294b69c85f4..f99b6f30192 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -114,13 +114,17 @@ impl<'a> Tarball<'a> { self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644); } + let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); + + self.builder.info(&format!("Dist {} ({})", self.component, self.target)); + let _time = crate::util::timeit(self.builder); + let mut component_name = self.component.clone(); if self.is_preview { component_name.push_str("-preview"); } let distdir = crate::dist::distdir(self.builder); - let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); cmd.arg("generate") .arg(format!("--product-name={}", self.product_name)) .arg("--rel-manifest-dir=rustlib") @@ -137,7 +141,6 @@ impl<'a> Tarball<'a> { .arg("--legacy-manifest-dirs=rustlib,cargo") .arg(format!("--component-name={}", component_name)); self.builder.run(&mut cmd); - t!(std::fs::remove_dir_all(&self.temp_dir)); distdir.join(format!("{}-{}.tar.gz", self.pkgname, self.target)) -- cgit 1.4.1-3-g733a5 From 79f60fbd0410d1cfcbc4ddc8cba7bb11e1dd65ba Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 26 Nov 2020 22:54:35 +0100 Subject: bootstrap: convert rust-std to use Tarball --- src/bootstrap/dist.rs | 38 ++++++++------------------------------ src/bootstrap/tarball.rs | 10 ++++++++++ 2 files changed, 18 insertions(+), 30 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 0e00649fc03..98f2b28918a 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -559,7 +559,7 @@ pub struct Std { } impl Step for Std { - type Output = PathBuf; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -577,46 +577,24 @@ impl Step for Std { }); } - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; - let name = pkgname(builder, "rust-std"); - let archive = distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)); if skip_host_target_lib(builder, compiler) { - return archive; + return None; } builder.ensure(compile::Std { compiler, target }); - let image = tmpdir(builder).join(format!("{}-{}-image", name, target.triple)); - let _ = fs::remove_dir_all(&image); + let mut tarball = Tarball::new(builder, "rust-std", &target.triple); + tarball.include_target_in_component_name(true); let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); let stamp = compile::libstd_stamp(builder, compiler_to_use, target); - copy_target_libs(builder, target, &image, &stamp); - - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=std-is-standing-at-the-ready.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg(format!("--component-name=rust-std-{}", target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo"); + copy_target_libs(builder, target, &tarball.image_dir(), &stamp); - builder - .info(&format!("Dist std stage{} ({} -> {})", compiler.stage, &compiler.host, target)); - let _time = timeit(builder); - builder.run(&mut cmd); - builder.remove_dir(&image); - archive + Some(tarball.generate()) } } @@ -1699,7 +1677,7 @@ impl Step for Extended { tarballs.extend(rustfmt_installer.clone()); tarballs.extend(llvm_tools_installer); tarballs.push(analysis_installer); - tarballs.push(std_installer); + tarballs.push(std_installer.expect("missing std")); if let Some(docs_installer) = docs_installer { tarballs.push(docs_installer); } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index f99b6f30192..bde437723bb 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -35,6 +35,7 @@ pub(crate) struct Tarball<'a> { overlay_dir: PathBuf, work_dir: PathBuf, + include_target_in_component_name: bool, is_preview: bool, } @@ -63,6 +64,7 @@ impl<'a> Tarball<'a> { overlay_dir, work_dir, + include_target_in_component_name: false, is_preview: false, } } @@ -75,6 +77,10 @@ impl<'a> Tarball<'a> { self.product_name = name.into(); } + pub(crate) fn include_target_in_component_name(&mut self, include: bool) { + self.include_target_in_component_name = include; + } + pub(crate) fn is_preview(&mut self, is: bool) { self.is_preview = is; } @@ -123,6 +129,10 @@ impl<'a> Tarball<'a> { if self.is_preview { component_name.push_str("-preview"); } + if self.include_target_in_component_name { + component_name.push('-'); + component_name.push_str(&self.target); + } let distdir = crate::dist::distdir(self.builder); cmd.arg("generate") -- cgit 1.4.1-3-g733a5 From c0cadc9eb72e6147647bd1b7995851e371167f24 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 12:46:02 +0100 Subject: bootstrap: convert rustc-dev to use Tarball --- src/bootstrap/dist.rs | 56 +++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 40 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 98f2b28918a..1e0f3b96958 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -605,7 +605,7 @@ pub struct RustcDev { } impl Step for RustcDev { - type Output = PathBuf; + type Output = Option; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -624,60 +624,36 @@ impl Step for RustcDev { }); } - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; - - let name = pkgname(builder, "rustc-dev"); - let archive = distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)); if skip_host_target_lib(builder, compiler) { - return archive; + return None; } builder.ensure(compile::Rustc { compiler, target }); - let image = tmpdir(builder).join(format!("{}-{}-image", name, target.triple)); - let _ = fs::remove_dir_all(&image); + let tarball = Tarball::new(builder, "rustc-dev", &target.triple); let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); let stamp = compile::librustc_stamp(builder, compiler_to_use, target); - copy_target_libs(builder, target, &image, &stamp); + copy_target_libs(builder, target, tarball.image_dir(), &stamp); - // Copy compiler sources. - let dst_src = image.join("lib/rustlib/rustc-src/rust"); - t!(fs::create_dir_all(&dst_src)); - - let src_files = ["Cargo.lock"]; + let src_files = &["Cargo.lock"]; // This is the reduced set of paths which will become the rustc-dev component // (essentially the compiler crates and all of their path dependencies). - copy_src_dirs(builder, &builder.src, &["compiler"], &[], &dst_src); - for file in src_files.iter() { - builder.copy(&builder.src.join(file), &dst_src.join(file)); + copy_src_dirs( + builder, + &builder.src, + &["compiler"], + &[], + &tarball.image_dir().join("lib/rustlib/rustc-src/rust"), + ); + for file in src_files { + tarball.add_file(builder.src.join(file), "lib/rustlib/rustc-src/rust", 0o644); } - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rust-is-ready-to-develop.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg(format!("--component-name=rustc-dev-{}", target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo"); - - builder.info(&format!( - "Dist rustc-dev stage{} ({} -> {})", - compiler.stage, &compiler.host, target - )); - let _time = timeit(builder); - builder.run(&mut cmd); - builder.remove_dir(&image); - archive + Some(tarball.generate()) } } -- cgit 1.4.1-3-g733a5 From c4aaff65f0cac8fe4375423f36d544440e47878b Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 12:52:44 +0100 Subject: bootstrap: convert rust-analysis to use Tarball --- src/bootstrap/dist.rs | 48 ++++++++++++------------------------------------ 1 file changed, 12 insertions(+), 36 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 1e0f3b96958..e342c0ddf63 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -664,7 +664,7 @@ pub struct Analysis { } impl Step for Analysis { - type Output = PathBuf; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -687,52 +687,26 @@ impl Step for Analysis { } /// Creates a tarball of save-analysis metadata, if available. - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); - let name = pkgname(builder, "rust-analysis"); - if compiler.host != builder.config.build { - return distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)); + return None; } builder.ensure(compile::Std { compiler, target }); - - let image = tmpdir(builder).join(format!("{}-{}-image", name, target.triple)); - let src = builder .stage_out(compiler, Mode::Std) .join(target.triple) .join(builder.cargo_dir()) - .join("deps"); - - let image_src = src.join("save-analysis"); - let dst = image.join("lib/rustlib").join(target.triple).join("analysis"); - t!(fs::create_dir_all(&dst)); - builder.info(&format!("image_src: {:?}, dst: {:?}", image_src, dst)); - builder.cp_r(&image_src, &dst); - - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=save-analysis-saved.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg(format!("--component-name=rust-analysis-{}", target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo"); + .join("deps") + .join("save-analysis"); - builder.info("Dist analysis"); - let _time = timeit(builder); - builder.run(&mut cmd); - builder.remove_dir(&image); - distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)) + let mut tarball = Tarball::new(builder, "rust-analysis", &target.triple); + tarball.include_target_in_component_name(true); + tarball.add_dir(src, format!("lib/rustlib/{}/analysis", target.triple)); + Some(tarball.generate()) } } @@ -1652,7 +1626,9 @@ impl Step for Extended { tarballs.extend(miri_installer.clone()); tarballs.extend(rustfmt_installer.clone()); tarballs.extend(llvm_tools_installer); - tarballs.push(analysis_installer); + if let Some(analysis_installer) = analysis_installer { + tarballs.push(analysis_installer); + } tarballs.push(std_installer.expect("missing std")); if let Some(docs_installer) = docs_installer { tarballs.push(docs_installer); -- cgit 1.4.1-3-g733a5 From 8a711a00a7f0cd5470255a65a711d47e46d46c14 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 13:11:11 +0100 Subject: bootstrap: convert cargo to use Tarball --- src/bootstrap/dist.rs | 71 ++++++++++-------------------------------------- src/bootstrap/tarball.rs | 30 +++++++++++++++++++- 2 files changed, 44 insertions(+), 57 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index e342c0ddf63..7e7c7edceff 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1015,72 +1015,31 @@ impl Step for Cargo { let compiler = self.compiler; let target = self.target; + let cargo = builder.ensure(tool::Cargo { compiler, target }); let src = builder.src.join("src/tools/cargo"); let etc = src.join("src/etc"); - let release_num = builder.release_num("cargo"); - let name = pkgname(builder, "cargo"); - let version = builder.cargo_info.version(builder, &release_num); - - let tmp = tmpdir(builder); - let image = tmp.join("cargo-image"); - drop(fs::remove_dir_all(&image)); - builder.create_dir(&image); // Prepare the image directory - builder.create_dir(&image.join("share/zsh/site-functions")); - builder.create_dir(&image.join("etc/bash_completion.d")); - let cargo = builder.ensure(tool::Cargo { compiler, target }); - builder.install(&cargo, &image.join("bin"), 0o755); + let mut tarball = Tarball::new(builder, "cargo", &target.triple); + tarball.set_overlay(OverlayKind::Cargo); + + tarball.add_file(&cargo, "bin", 0o755); + tarball.add_file(src.join("README.md"), "share/doc/cargo", 0o644); + tarball.add_file(src.join("LICENSE-MIT"), "share/doc/cargo", 0o644); + tarball.add_file(src.join("LICENSE-APACHE"), "share/doc/cargo", 0o644); + tarball.add_file(src.join("LICENSE-THIRD-PARTY"), "share/doc/cargo", 0o644); + tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644); + tarball.add_renamed_file(etc.join("cargo.bashcomp.sh"), "etc/bash_completion.d", "cargo"); + tarball.add_dir(etc.join("man"), "share/man/man1"); + for dirent in fs::read_dir(cargo.parent().unwrap()).expect("read_dir") { let dirent = dirent.expect("read dir entry"); if dirent.file_name().to_str().expect("utf8").starts_with("cargo-credential-") { - builder.install(&dirent.path(), &image.join("libexec"), 0o755); + tarball.add_file(&dirent.path(), "libexec", 0o755); } } - for man in t!(etc.join("man").read_dir()) { - let man = t!(man); - builder.install(&man.path(), &image.join("share/man/man1"), 0o644); - } - builder.install(&etc.join("_cargo"), &image.join("share/zsh/site-functions"), 0o644); - builder.copy(&etc.join("cargo.bashcomp.sh"), &image.join("etc/bash_completion.d/cargo")); - let doc = image.join("share/doc/cargo"); - builder.install(&src.join("README.md"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-THIRD-PARTY"), &doc, 0o644); - - // Prepare the overlay - let overlay = tmp.join("cargo-overlay"); - drop(fs::remove_dir_all(&overlay)); - builder.create_dir(&overlay); - builder.install(&src.join("README.md"), &overlay, 0o644); - builder.install(&src.join("LICENSE-MIT"), &overlay, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &overlay, 0o644); - builder.install(&src.join("LICENSE-THIRD-PARTY"), &overlay, 0o644); - builder.create(&overlay.join("version"), &version); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rust-is-ready-to-roll.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--component-name=cargo") - .arg("--legacy-manifest-dirs=rustlib,cargo"); - builder.info(&format!("Dist cargo stage{} ({})", compiler.stage, target)); - let _time = timeit(builder); - builder.run(&mut cmd); - distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)) + tarball.generate() } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index bde437723bb..5340995ce96 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -8,6 +8,7 @@ use crate::builder::Builder; pub(crate) enum OverlayKind { Rust, LLVM, + Cargo, } impl OverlayKind { @@ -17,6 +18,22 @@ impl OverlayKind { OverlayKind::LLVM => { &["src/llvm-project/llvm/LICENSE.TXT", "src/llvm-project/llvm/README.txt"] } + OverlayKind::Cargo => &[ + "src/tools/cargo/README.md", + "src/tools/cargo/LICENSE-MIT", + "src/tools/cargo/LICENSE-APACHE", + "src/tools/cargo/LICENSE-THIRD-PARTY", + ], + } + } + + fn version(&self, builder: &Builder<'_>) -> String { + match self { + OverlayKind::Rust => builder.rust_version(), + OverlayKind::LLVM => builder.rust_version(), + OverlayKind::Cargo => { + builder.cargo_info.version(builder, &builder.release_num("cargo")) + } } } } @@ -103,6 +120,17 @@ impl<'a> Tarball<'a> { self.builder.install(src.as_ref(), &destdir, perms); } + pub(crate) fn add_renamed_file( + &self, + src: impl AsRef, + destdir: impl AsRef, + new_name: &str, + ) { + let destdir = self.image_dir.join(destdir.as_ref()); + t!(std::fs::create_dir_all(&destdir)); + self.builder.copy(src.as_ref(), &destdir.join(new_name)); + } + pub(crate) fn add_dir(&self, src: impl AsRef, dest: impl AsRef) { let dest = self.image_dir.join(dest.as_ref()); @@ -112,7 +140,7 @@ impl<'a> Tarball<'a> { pub(crate) fn generate(self) -> PathBuf { t!(std::fs::create_dir_all(&self.overlay_dir)); - self.builder.create(&self.overlay_dir.join("version"), &self.builder.rust_version()); + self.builder.create(&self.overlay_dir.join("version"), &self.overlay.version(self.builder)); if let Some(sha) = self.builder.rust_sha() { self.builder.create(&self.overlay_dir.join("git-commit-hash"), &sha); } -- cgit 1.4.1-3-g733a5 From 521b884913b603ddbdcc1af97b772e40d4ea5f84 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 17:43:03 +0100 Subject: bootstrap: convert clippy to use Tarball --- src/bootstrap/dist.rs | 58 +++++++++--------------------------------------- src/bootstrap/tarball.rs | 9 ++++++++ 2 files changed, 19 insertions(+), 48 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 7e7c7edceff..47ad8fae26b 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1256,16 +1256,6 @@ impl Step for Clippy { let target = self.target; assert!(builder.config.extended); - let src = builder.src.join("src/tools/clippy"); - let release_num = builder.release_num("clippy"); - let name = pkgname(builder, "clippy"); - let version = builder.clippy_info.version(builder, &release_num); - - let tmp = tmpdir(builder); - let image = tmp.join("clippy-image"); - drop(fs::remove_dir_all(&image)); - builder.create_dir(&image); - // Prepare the image directory // We expect clippy to build, because we've exited this step above if tool // state for clippy isn't testing. @@ -1275,45 +1265,17 @@ impl Step for Clippy { let cargoclippy = builder .ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() }) .expect("clippy expected to build - essential tool"); + let src = builder.src.join("src/tools/clippy"); - builder.install(&clippy, &image.join("bin"), 0o755); - builder.install(&cargoclippy, &image.join("bin"), 0o755); - let doc = image.join("share/doc/clippy"); - builder.install(&src.join("README.md"), &doc, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - - // Prepare the overlay - let overlay = tmp.join("clippy-overlay"); - drop(fs::remove_dir_all(&overlay)); - t!(fs::create_dir_all(&overlay)); - builder.install(&src.join("README.md"), &overlay, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - builder.create(&overlay.join("version"), &version); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=clippy-ready-to-serve.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=clippy-preview"); - - builder.info(&format!("Dist clippy stage{} ({})", compiler.stage, target)); - let _time = timeit(builder); - builder.run(&mut cmd); - distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)) + let mut tarball = Tarball::new(builder, "clippy", &target.triple); + tarball.set_overlay(OverlayKind::Clippy); + tarball.is_preview(true); + tarball.add_file(clippy, "bin", 0o755); + tarball.add_file(cargoclippy, "bin", 0o755); + tarball.add_file(src.join("README.md"), "share/doc/clippy", 0o644); + tarball.add_file(src.join("LICENSE-APACHE"), "share/doc/clippy", 0o644); + tarball.add_file(src.join("LICENSE-MIT"), "share/doc/clippy", 0o644); + tarball.generate() } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 5340995ce96..c0c84222e7d 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -9,6 +9,7 @@ pub(crate) enum OverlayKind { Rust, LLVM, Cargo, + Clippy, } impl OverlayKind { @@ -24,6 +25,11 @@ impl OverlayKind { "src/tools/cargo/LICENSE-APACHE", "src/tools/cargo/LICENSE-THIRD-PARTY", ], + OverlayKind::Clippy => &[ + "src/tools/clippy/README.md", + "src/tools/clippy/LICENSE-APACHE", + "src/tools/clippy/LICENSE-MIT", + ], } } @@ -34,6 +40,9 @@ impl OverlayKind { OverlayKind::Cargo => { builder.cargo_info.version(builder, &builder.release_num("cargo")) } + OverlayKind::Clippy => { + builder.clippy_info.version(builder, &builder.release_num("clippy")) + } } } } -- cgit 1.4.1-3-g733a5 From 32afb3c436eb3909a636fd4fce20a1ba03cc88ec Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 17:56:22 +0100 Subject: bootstrap: simplify including licenses and readmes to tarballs --- src/bootstrap/dist.rs | 10 ++-------- src/bootstrap/tarball.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 47ad8fae26b..aa4d518d014 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1024,13 +1024,10 @@ impl Step for Cargo { tarball.set_overlay(OverlayKind::Cargo); tarball.add_file(&cargo, "bin", 0o755); - tarball.add_file(src.join("README.md"), "share/doc/cargo", 0o644); - tarball.add_file(src.join("LICENSE-MIT"), "share/doc/cargo", 0o644); - tarball.add_file(src.join("LICENSE-APACHE"), "share/doc/cargo", 0o644); - tarball.add_file(src.join("LICENSE-THIRD-PARTY"), "share/doc/cargo", 0o644); tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644); tarball.add_renamed_file(etc.join("cargo.bashcomp.sh"), "etc/bash_completion.d", "cargo"); tarball.add_dir(etc.join("man"), "share/man/man1"); + tarball.add_legal_and_readme_to("share/doc/cargo"); for dirent in fs::read_dir(cargo.parent().unwrap()).expect("read_dir") { let dirent = dirent.expect("read dir entry"); @@ -1265,16 +1262,13 @@ impl Step for Clippy { let cargoclippy = builder .ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() }) .expect("clippy expected to build - essential tool"); - let src = builder.src.join("src/tools/clippy"); let mut tarball = Tarball::new(builder, "clippy", &target.triple); tarball.set_overlay(OverlayKind::Clippy); tarball.is_preview(true); tarball.add_file(clippy, "bin", 0o755); tarball.add_file(cargoclippy, "bin", 0o755); - tarball.add_file(src.join("README.md"), "share/doc/clippy", 0o644); - tarball.add_file(src.join("LICENSE-APACHE"), "share/doc/clippy", 0o644); - tarball.add_file(src.join("LICENSE-MIT"), "share/doc/clippy", 0o644); + tarball.add_legal_and_readme_to("share/doc/clippy"); tarball.generate() } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index c0c84222e7d..2c8f69e94b3 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -13,7 +13,7 @@ pub(crate) enum OverlayKind { } impl OverlayKind { - fn included_files(&self) -> &[&str] { + fn legal_and_readme(&self) -> &[&str] { match self { OverlayKind::Rust => &["COPYRIGHT", "LICENSE-APACHE", "LICENSE-MIT", "README.md"], OverlayKind::LLVM => { @@ -140,6 +140,12 @@ impl<'a> Tarball<'a> { self.builder.copy(src.as_ref(), &destdir.join(new_name)); } + pub(crate) fn add_legal_and_readme_to(&self, destdir: impl AsRef) { + for file in self.overlay.legal_and_readme() { + self.add_file(self.builder.src.join(file), destdir.as_ref(), 0o644); + } + } + pub(crate) fn add_dir(&self, src: impl AsRef, dest: impl AsRef) { let dest = self.image_dir.join(dest.as_ref()); @@ -153,7 +159,7 @@ impl<'a> Tarball<'a> { if let Some(sha) = self.builder.rust_sha() { self.builder.create(&self.overlay_dir.join("git-commit-hash"), &sha); } - for file in self.overlay.included_files() { + for file in self.overlay.legal_and_readme() { self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644); } -- cgit 1.4.1-3-g733a5 From 2073ea5c07ea5a83d17fb7d08f67cc55e1010aaf Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 18:03:41 +0100 Subject: bootstrap: convert miri to use Tarball --- src/bootstrap/dist.rs | 58 ++++++------------------------------------------ src/bootstrap/tarball.rs | 7 ++++++ 2 files changed, 14 insertions(+), 51 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index aa4d518d014..a884e7ee2cc 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1303,19 +1303,6 @@ impl Step for Miri { let target = self.target; assert!(builder.config.extended); - let src = builder.src.join("src/tools/miri"); - let release_num = builder.release_num("miri"); - let name = pkgname(builder, "miri"); - let version = builder.miri_info.version(builder, &release_num); - - let tmp = tmpdir(builder); - let image = tmp.join("miri-image"); - drop(fs::remove_dir_all(&image)); - builder.create_dir(&image); - - // Prepare the image directory - // We expect miri to build, because we've exited this step above if tool - // state for miri isn't testing. let miri = builder .ensure(tool::Miri { compiler, target, extra_features: Vec::new() }) .or_else(|| { @@ -1329,44 +1316,13 @@ impl Step for Miri { None })?; - builder.install(&miri, &image.join("bin"), 0o755); - builder.install(&cargomiri, &image.join("bin"), 0o755); - let doc = image.join("share/doc/miri"); - builder.install(&src.join("README.md"), &doc, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - - // Prepare the overlay - let overlay = tmp.join("miri-overlay"); - drop(fs::remove_dir_all(&overlay)); - t!(fs::create_dir_all(&overlay)); - builder.install(&src.join("README.md"), &overlay, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - builder.create(&overlay.join("version"), &version); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=miri-ready-to-serve.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=miri-preview"); - - builder.info(&format!("Dist miri stage{} ({})", compiler.stage, target)); - let _time = timeit(builder); - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))) + let mut tarball = Tarball::new(builder, "miri", &target.triple); + tarball.set_overlay(OverlayKind::Miri); + tarball.is_preview(true); + tarball.add_file(miri, "bin", 0o755); + tarball.add_file(cargomiri, "bin", 0o755); + tarball.add_legal_and_readme_to("share/doc/miri"); + Some(tarball.generate()) } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 2c8f69e94b3..0e705a93902 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -10,6 +10,7 @@ pub(crate) enum OverlayKind { LLVM, Cargo, Clippy, + Miri, } impl OverlayKind { @@ -30,6 +31,11 @@ impl OverlayKind { "src/tools/clippy/LICENSE-APACHE", "src/tools/clippy/LICENSE-MIT", ], + OverlayKind::Miri => &[ + "src/tools/miri/README.md", + "src/tools/miri/LICENSE-APACHE", + "src/tools/miri/LICENSE-MIT", + ], } } @@ -43,6 +49,7 @@ impl OverlayKind { OverlayKind::Clippy => { builder.clippy_info.version(builder, &builder.release_num("clippy")) } + OverlayKind::Miri => builder.miri_info.version(builder, &builder.release_num("miri")), } } } -- cgit 1.4.1-3-g733a5 From 2b54f0de3794e5fc38f0d4eb1364cb67a041aa4f Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 18:07:58 +0100 Subject: bootstrap: convert rustfmt to use Tarball --- src/bootstrap/dist.rs | 56 ++++++------------------------------------------ src/bootstrap/tarball.rs | 9 ++++++++ 2 files changed, 16 insertions(+), 49 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index a884e7ee2cc..35e0aeba146 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1355,17 +1355,6 @@ impl Step for Rustfmt { let compiler = self.compiler; let target = self.target; - let src = builder.src.join("src/tools/rustfmt"); - let release_num = builder.release_num("rustfmt"); - let name = pkgname(builder, "rustfmt"); - let version = builder.rustfmt_info.version(builder, &release_num); - - let tmp = tmpdir(builder); - let image = tmp.join("rustfmt-image"); - drop(fs::remove_dir_all(&image)); - builder.create_dir(&image); - - // Prepare the image directory let rustfmt = builder .ensure(tool::Rustfmt { compiler, target, extra_features: Vec::new() }) .or_else(|| { @@ -1379,44 +1368,13 @@ impl Step for Rustfmt { None })?; - builder.install(&rustfmt, &image.join("bin"), 0o755); - builder.install(&cargofmt, &image.join("bin"), 0o755); - let doc = image.join("share/doc/rustfmt"); - builder.install(&src.join("README.md"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - - // Prepare the overlay - let overlay = tmp.join("rustfmt-overlay"); - drop(fs::remove_dir_all(&overlay)); - builder.create_dir(&overlay); - builder.install(&src.join("README.md"), &overlay, 0o644); - builder.install(&src.join("LICENSE-MIT"), &overlay, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &overlay, 0o644); - builder.create(&overlay.join("version"), &version); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=rustfmt-ready-to-fmt.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=rustfmt-preview"); - - builder.info(&format!("Dist Rustfmt stage{} ({})", compiler.stage, target)); - let _time = timeit(builder); - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))) + let mut tarball = Tarball::new(builder, "rustfmt", &target.triple); + tarball.set_overlay(OverlayKind::Rustfmt); + tarball.is_preview(true); + tarball.add_file(rustfmt, "bin", 0o755); + tarball.add_file(cargofmt, "bin", 0o755); + tarball.add_legal_and_readme_to("share/doc/rustfmt"); + Some(tarball.generate()) } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 0e705a93902..8543f9d4a38 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -11,6 +11,7 @@ pub(crate) enum OverlayKind { Cargo, Clippy, Miri, + Rustfmt, } impl OverlayKind { @@ -36,6 +37,11 @@ impl OverlayKind { "src/tools/miri/LICENSE-APACHE", "src/tools/miri/LICENSE-MIT", ], + OverlayKind::Rustfmt => &[ + "src/tools/rustfmt/README.md", + "src/tools/rustfmt/LICENSE-APACHE", + "src/tools/rustfmt/LICENSE-MIT", + ], } } @@ -50,6 +56,9 @@ impl OverlayKind { builder.clippy_info.version(builder, &builder.release_num("clippy")) } OverlayKind::Miri => builder.miri_info.version(builder, &builder.release_num("miri")), + OverlayKind::Rustfmt => { + builder.rustfmt_info.version(builder, &builder.release_num("rustfmt")) + } } } } -- cgit 1.4.1-3-g733a5 From cfb23e845e56718fa33b7b76d30e2edec992d659 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 18:12:17 +0100 Subject: bootstrap: convert rls to use Tarball --- src/bootstrap/dist.rs | 56 ++++++------------------------------------------ src/bootstrap/tarball.rs | 7 ++++++ 2 files changed, 13 insertions(+), 50 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 35e0aeba146..c31a938c746 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1070,19 +1070,6 @@ impl Step for Rls { let target = self.target; assert!(builder.config.extended); - let src = builder.src.join("src/tools/rls"); - let release_num = builder.release_num("rls"); - let name = pkgname(builder, "rls"); - let version = builder.rls_info.version(builder, &release_num); - - let tmp = tmpdir(builder); - let image = tmp.join("rls-image"); - drop(fs::remove_dir_all(&image)); - t!(fs::create_dir_all(&image)); - - // Prepare the image directory - // We expect RLS to build, because we've exited this step above if tool - // state for RLS isn't testing. let rls = builder .ensure(tool::Rls { compiler, target, extra_features: Vec::new() }) .or_else(|| { @@ -1090,43 +1077,12 @@ impl Step for Rls { None })?; - builder.install(&rls, &image.join("bin"), 0o755); - let doc = image.join("share/doc/rls"); - builder.install(&src.join("README.md"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - - // Prepare the overlay - let overlay = tmp.join("rls-overlay"); - drop(fs::remove_dir_all(&overlay)); - t!(fs::create_dir_all(&overlay)); - builder.install(&src.join("README.md"), &overlay, 0o644); - builder.install(&src.join("LICENSE-MIT"), &overlay, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &overlay, 0o644); - builder.create(&overlay.join("version"), &version); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=RLS-ready-to-serve.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=rls-preview"); - - builder.info(&format!("Dist RLS stage{} ({})", compiler.stage, target.triple)); - let _time = timeit(builder); - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))) + let mut tarball = Tarball::new(builder, "rls", &target.triple); + tarball.set_overlay(OverlayKind::RLS); + tarball.is_preview(true); + tarball.add_file(rls, "bin", 0o755); + tarball.add_legal_and_readme_to("share/doc/rls"); + Some(tarball.generate()) } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 8543f9d4a38..efc85a1445a 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -12,6 +12,7 @@ pub(crate) enum OverlayKind { Clippy, Miri, Rustfmt, + RLS, } impl OverlayKind { @@ -42,6 +43,11 @@ impl OverlayKind { "src/tools/rustfmt/LICENSE-APACHE", "src/tools/rustfmt/LICENSE-MIT", ], + OverlayKind::RLS => &[ + "src/tools/rls/README.md", + "src/tools/rls/LICENSE-APACHE", + "src/tools/rls/LICENSE-MIT", + ], } } @@ -59,6 +65,7 @@ impl OverlayKind { OverlayKind::Rustfmt => { builder.rustfmt_info.version(builder, &builder.release_num("rustfmt")) } + OverlayKind::RLS => builder.rls_info.version(builder, &builder.release_num("rls")), } } } -- cgit 1.4.1-3-g733a5 From 2e0a16cf0d67f61d85ff7631846e9c3c6e20c85a Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 27 Nov 2020 18:20:23 +0100 Subject: bootstrap: convert rust-analyzer to use Tarball --- src/bootstrap/dist.rs | 56 ++++++------------------------------------------ src/bootstrap/tarball.rs | 9 ++++++++ 2 files changed, 15 insertions(+), 50 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index c31a938c746..b1a61500a70 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1122,60 +1122,16 @@ impl Step for RustAnalyzer { return None; } - let src = builder.src.join("src/tools/rust-analyzer"); - let release_num = builder.release_num("rust-analyzer/crates/rust-analyzer"); - let name = pkgname(builder, "rust-analyzer"); - let version = builder.rust_analyzer_info.version(builder, &release_num); - - let tmp = tmpdir(builder); - let image = tmp.join("rust-analyzer-image"); - drop(fs::remove_dir_all(&image)); - builder.create_dir(&image); - - // Prepare the image directory - // We expect rust-analyer to always build, as it doesn't depend on rustc internals - // and doesn't have associated toolstate. let rust_analyzer = builder .ensure(tool::RustAnalyzer { compiler, target, extra_features: Vec::new() }) .expect("rust-analyzer always builds"); - builder.install(&rust_analyzer, &image.join("bin"), 0o755); - let doc = image.join("share/doc/rust-analyzer"); - builder.install(&src.join("README.md"), &doc, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - - // Prepare the overlay - let overlay = tmp.join("rust-analyzer-overlay"); - drop(fs::remove_dir_all(&overlay)); - t!(fs::create_dir_all(&overlay)); - builder.install(&src.join("README.md"), &overlay, 0o644); - builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); - builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); - builder.create(&overlay.join("version"), &version); - - // Generate the installer tarball - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=rust-analyzer-ready-to-serve.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=rust-analyzer-preview"); - - builder.info(&format!("Dist rust-analyzer stage{} ({})", compiler.stage, target)); - let _time = timeit(builder); - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))) + let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple); + tarball.set_overlay(OverlayKind::RustAnalyzer); + tarball.is_preview(true); + tarball.add_file(rust_analyzer, "bin", 0o755); + tarball.add_legal_and_readme_to("share/doc/rust-analyzer"); + Some(tarball.generate()) } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index efc85a1445a..8a23d36346e 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -13,6 +13,7 @@ pub(crate) enum OverlayKind { Miri, Rustfmt, RLS, + RustAnalyzer, } impl OverlayKind { @@ -48,6 +49,11 @@ impl OverlayKind { "src/tools/rls/LICENSE-APACHE", "src/tools/rls/LICENSE-MIT", ], + OverlayKind::RustAnalyzer => &[ + "src/tools/rust-analyzer/README.md", + "src/tools/rust-analyzer/LICENSE-APACHE", + "src/tools/rust-analyzer/LICENSE-MIT", + ], } } @@ -66,6 +72,9 @@ impl OverlayKind { builder.rustfmt_info.version(builder, &builder.release_num("rustfmt")) } OverlayKind::RLS => builder.rls_info.version(builder, &builder.release_num("rls")), + OverlayKind::RustAnalyzer => builder + .rust_analyzer_info + .version(builder, &builder.release_num("rust-analyzer/crates/rust-analyzer")), } } } -- cgit 1.4.1-3-g733a5 From 1906c42962b1f2bef084474e09b211e48ed2bda7 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 30 Nov 2020 13:25:34 +0100 Subject: bootstrap: convert rust-src to use Tarball --- src/bootstrap/dist.rs | 30 +++--------------------------- src/bootstrap/tarball.rs | 31 +++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 33 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index b1a61500a70..c89b378f820 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -814,9 +814,7 @@ impl Step for Src { /// Creates the `rust-src` installer component fn run(self, builder: &Builder<'_>) -> PathBuf { - let name = pkgname(builder, "rust-src"); - let image = tmpdir(builder).join(format!("{}-image", name)); - let _ = fs::remove_dir_all(&image); + let tarball = Tarball::new_targetless(builder, "rust-src"); // A lot of tools expect the rust-src component to be entirely in this directory, so if you // change that (e.g. by adding another directory `lib/rustlib/src/foo` or @@ -825,8 +823,7 @@ impl Step for Src { // // NOTE: if you update the paths here, you also should update the "virtual" path // translation code in `imported_source_files` in `src/librustc_metadata/rmeta/decoder.rs` - let dst_src = image.join("lib/rustlib/src/rust"); - t!(fs::create_dir_all(&dst_src)); + let dst_src = tarball.image_dir().join("lib/rustlib/src/rust"); let src_files = ["Cargo.lock"]; // This is the reduced set of paths which will become the rust-src component @@ -846,28 +843,7 @@ impl Step for Src { builder.copy(&builder.src.join(file), &dst_src.join(file)); } - // Create source tarball in rust-installer format - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Awesome-Source.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}", name)) - .arg("--component-name=rust-src") - .arg("--legacy-manifest-dirs=rustlib,cargo"); - - builder.info("Dist src"); - let _time = timeit(builder); - builder.run(&mut cmd); - - builder.remove_dir(&image); - distdir(builder).join(&format!("{}.tar.gz", name)) + tarball.generate() } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 8a23d36346e..27769cab5af 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -84,7 +84,7 @@ pub(crate) struct Tarball<'a> { pkgname: String, component: String, - target: String, + target: Option, product_name: String, overlay: OverlayKind, @@ -99,6 +99,14 @@ pub(crate) struct Tarball<'a> { impl<'a> Tarball<'a> { pub(crate) fn new(builder: &'a Builder<'a>, component: &str, target: &str) -> Self { + Self::new_inner(builder, component, Some(target.into())) + } + + pub(crate) fn new_targetless(builder: &'a Builder<'a>, component: &str) -> Self { + Self::new_inner(builder, component, None) + } + + fn new_inner(builder: &'a Builder<'a>, component: &str, target: Option) -> Self { let pkgname = crate::dist::pkgname(builder, component); let temp_dir = builder.out.join("tmp").join("tarball").join(component); @@ -113,7 +121,7 @@ impl<'a> Tarball<'a> { pkgname, component: component.into(), - target: target.into(), + target, product_name: "Rust".into(), overlay: OverlayKind::Rust, @@ -197,7 +205,14 @@ impl<'a> Tarball<'a> { let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); - self.builder.info(&format!("Dist {} ({})", self.component, self.target)); + let package_name = if let Some(target) = &self.target { + self.builder.info(&format!("Dist {} ({})", self.component, target)); + format!("{}-{}", self.pkgname, target) + } else { + self.builder.info(&format!("Dist {}", self.component)); + self.pkgname.clone() + }; + let _time = crate::util::timeit(self.builder); let mut component_name = self.component.clone(); @@ -206,7 +221,11 @@ impl<'a> Tarball<'a> { } if self.include_target_in_component_name { component_name.push('-'); - component_name.push_str(&self.target); + component_name.push_str( + &self + .target + .expect("include_target_in_component_name used in a targetless tarball"), + ); } let distdir = crate::dist::distdir(self.builder); @@ -222,12 +241,12 @@ impl<'a> Tarball<'a> { .arg(&distdir) .arg("--non-installed-overlay") .arg(self.overlay_dir) - .arg(format!("--package-name={}-{}", self.pkgname, self.target)) + .arg(format!("--package-name={}", package_name)) .arg("--legacy-manifest-dirs=rustlib,cargo") .arg(format!("--component-name={}", component_name)); self.builder.run(&mut cmd); t!(std::fs::remove_dir_all(&self.temp_dir)); - distdir.join(format!("{}-{}.tar.gz", self.pkgname, self.target)) + distdir.join(format!("{}.tar.gz", package_name)) } } -- cgit 1.4.1-3-g733a5 From 48924ab7088802123a64af77e5201ddfc1f1a733 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 2 Dec 2020 13:29:45 +0100 Subject: bootstrap: convert rust to use Tarball --- src/bootstrap/dist.rs | 43 +++--------------------- src/bootstrap/tarball.rs | 85 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 65 insertions(+), 63 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index c89b378f820..a68f1398817 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1314,21 +1314,7 @@ impl Step for Extended { let std_installer = builder.ensure(Std { compiler: builder.compiler(stage, target), target }); - let tmp = tmpdir(builder); - let overlay = tmp.join("extended-overlay"); let etc = builder.src.join("src/etc/installer"); - let work = tmp.join("work"); - - let _ = fs::remove_dir_all(&overlay); - builder.install(&builder.src.join("COPYRIGHT"), &overlay, 0o644); - builder.install(&builder.src.join("LICENSE-APACHE"), &overlay, 0o644); - builder.install(&builder.src.join("LICENSE-MIT"), &overlay, 0o644); - let version = builder.rust_version(); - builder.create(&overlay.join("version"), &version); - if let Some(sha) = builder.rust_sha() { - builder.create(&overlay.join("git-commit-hash"), &sha); - } - builder.install(&etc.join("README.md"), &overlay, 0o644); // When rust-std package split from rustc, we needed to ensure that during // upgrades rustc was upgraded before rust-std. To avoid rustc clobbering @@ -1353,31 +1339,12 @@ impl Step for Extended { if target.contains("pc-windows-gnu") { tarballs.push(mingw_installer.unwrap()); } - let mut input_tarballs = tarballs[0].as_os_str().to_owned(); - for tarball in &tarballs[1..] { - input_tarballs.push(","); - input_tarballs.push(tarball); - } - builder.info("building combined installer"); - let mut cmd = rust_installer(builder); - cmd.arg("combine") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=Rust-is-ready-to-roll.") - .arg("--work-dir") - .arg(&work) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg(format!("--package-name={}-{}", pkgname(builder, "rust"), target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--input-tarballs") - .arg(input_tarballs) - .arg("--non-installed-overlay") - .arg(&overlay); - let time = timeit(&builder); - builder.run(&mut cmd); - drop(time); + let mut tarball = Tarball::new(builder, "rust", &target.triple); + let work = tarball.persist_work_dir(); + tarball.combine(&tarballs); + + let tmp = tmpdir(builder).join("combined-tarball"); let mut license = String::new(); license += &builder.read(&builder.src.join("COPYRIGHT")); diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 27769cab5af..b4146450596 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -1,4 +1,7 @@ -use std::path::{Path, PathBuf}; +use std::{ + path::{Path, PathBuf}, + process::Command, +}; use build_helper::t; @@ -95,6 +98,7 @@ pub(crate) struct Tarball<'a> { include_target_in_component_name: bool, is_preview: bool, + delete_temp_dir: bool, } impl<'a> Tarball<'a> { @@ -132,6 +136,7 @@ impl<'a> Tarball<'a> { include_target_in_component_name: false, is_preview: false, + delete_temp_dir: true, } } @@ -193,7 +198,53 @@ impl<'a> Tarball<'a> { self.builder.cp_r(src.as_ref(), &dest); } + pub(crate) fn persist_work_dir(&mut self) -> PathBuf { + self.delete_temp_dir = false; + self.work_dir.clone() + } + pub(crate) fn generate(self) -> PathBuf { + let mut component_name = self.component.clone(); + if self.is_preview { + component_name.push_str("-preview"); + } + if self.include_target_in_component_name { + component_name.push('-'); + component_name.push_str( + &self + .target + .as_ref() + .expect("include_target_in_component_name used in a targetless tarball"), + ); + } + + self.run(|this, cmd| { + cmd.arg("generate") + .arg("--image-dir") + .arg(&this.image_dir) + .arg("--non-installed-overlay") + .arg(&this.overlay_dir) + .arg(format!("--component-name={}", &component_name)); + }) + } + + pub(crate) fn combine(self, tarballs: &[PathBuf]) { + let mut input_tarballs = tarballs[0].as_os_str().to_os_string(); + for tarball in &tarballs[1..] { + input_tarballs.push(","); + input_tarballs.push(tarball); + } + + self.run(|this, cmd| { + cmd.arg("combine") + .arg("--input-tarballs") + .arg(input_tarballs) + .arg("--non-installed-overlay") + .arg(&this.overlay_dir); + }); + } + + fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> PathBuf { t!(std::fs::create_dir_all(&self.overlay_dir)); self.builder.create(&self.overlay_dir.join("version"), &self.overlay.version(self.builder)); if let Some(sha) = self.builder.rust_sha() { @@ -215,37 +266,21 @@ impl<'a> Tarball<'a> { let _time = crate::util::timeit(self.builder); - let mut component_name = self.component.clone(); - if self.is_preview { - component_name.push_str("-preview"); - } - if self.include_target_in_component_name { - component_name.push('-'); - component_name.push_str( - &self - .target - .expect("include_target_in_component_name used in a targetless tarball"), - ); - } - let distdir = crate::dist::distdir(self.builder); - cmd.arg("generate") + build_cli(&self, &mut cmd); + cmd.arg("--rel-manifest-dir=rustlib") + .arg("--legacy-manifest-dirs=rustlib,cargo") .arg(format!("--product-name={}", self.product_name)) - .arg("--rel-manifest-dir=rustlib") .arg(format!("--success-message={} installed.", self.component)) - .arg("--image-dir") - .arg(self.image_dir) + .arg(format!("--package-name={}", package_name)) .arg("--work-dir") .arg(self.work_dir) .arg("--output-dir") - .arg(&distdir) - .arg("--non-installed-overlay") - .arg(self.overlay_dir) - .arg(format!("--package-name={}", package_name)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg(format!("--component-name={}", component_name)); + .arg(&distdir); self.builder.run(&mut cmd); - t!(std::fs::remove_dir_all(&self.temp_dir)); + if self.delete_temp_dir { + t!(std::fs::remove_dir_all(&self.temp_dir)); + } distdir.join(format!("{}.tar.gz", package_name)) } -- cgit 1.4.1-3-g733a5 From f18335edb2917a310b69a522e6f3fde30af3d419 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 7 Dec 2020 11:49:22 +0100 Subject: bootstrap: convert rustc-src to use Tarball --- src/bootstrap/dist.rs | 34 ++-------------------- src/bootstrap/tarball.rs | 73 ++++++++++++++++++++++++++++-------------------- 2 files changed, 45 insertions(+), 62 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index a68f1398817..258483bf134 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -37,10 +37,6 @@ pub fn tmpdir(builder: &Builder<'_>) -> PathBuf { builder.out.join("tmp/dist") } -fn rust_installer(builder: &Builder<'_>) -> Command { - builder.tool_cmd(Tool::RustInstaller) -} - fn missing_tool(tool_name: &str, skip: bool) { if skip { println!("Unable to build {}, skipping dist", tool_name) @@ -867,11 +863,8 @@ impl Step for PlainSourceTarball { /// Creates the plain source tarball fn run(self, builder: &Builder<'_>) -> PathBuf { - // Make sure that the root folder of tarball has the correct name - let plain_name = format!("{}-src", pkgname(builder, "rustc")); - let plain_dst_src = tmpdir(builder).join(&plain_name); - let _ = fs::remove_dir_all(&plain_dst_src); - t!(fs::create_dir_all(&plain_dst_src)); + let tarball = Tarball::new(builder, "rustc", "src"); + let plain_dst_src = tarball.image_dir(); // This is the set of root paths which will become part of the source package let src_files = [ @@ -914,28 +907,7 @@ impl Step for PlainSourceTarball { builder.run(&mut cmd); } - // Create plain source tarball - let plain_name = format!("rustc-{}-src", builder.rust_package_vers()); - let mut tarball = distdir(builder).join(&format!("{}.tar.gz", plain_name)); - tarball.set_extension(""); // strip .gz - tarball.set_extension(""); // strip .tar - if let Some(dir) = tarball.parent() { - builder.create_dir(&dir); - } - builder.info("running installer"); - let mut cmd = rust_installer(builder); - cmd.arg("tarball") - .arg("--input") - .arg(&plain_name) - .arg("--output") - .arg(&tarball) - .arg("--work-dir=.") - .current_dir(tmpdir(builder)); - - builder.info("Create plain source tarball"); - let _time = timeit(builder); - builder.run(&mut cmd); - distdir(builder).join(&format!("{}.tar.gz", plain_name)) + tarball.bare() } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index b4146450596..5d73a655427 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -94,7 +94,6 @@ pub(crate) struct Tarball<'a> { temp_dir: PathBuf, image_dir: PathBuf, overlay_dir: PathBuf, - work_dir: PathBuf, include_target_in_component_name: bool, is_preview: bool, @@ -113,12 +112,14 @@ impl<'a> Tarball<'a> { fn new_inner(builder: &'a Builder<'a>, component: &str, target: Option) -> Self { let pkgname = crate::dist::pkgname(builder, component); - let temp_dir = builder.out.join("tmp").join("tarball").join(component); + let mut temp_dir = builder.out.join("tmp").join("tarball"); + if let Some(target) = &target { + temp_dir = temp_dir.join(target); + } let _ = std::fs::remove_dir_all(&temp_dir); let image_dir = temp_dir.join("image"); let overlay_dir = temp_dir.join("overlay"); - let work_dir = temp_dir.join("work"); Self { builder, @@ -132,7 +133,6 @@ impl<'a> Tarball<'a> { temp_dir, image_dir, overlay_dir, - work_dir, include_target_in_component_name: false, is_preview: false, @@ -200,7 +200,7 @@ impl<'a> Tarball<'a> { pub(crate) fn persist_work_dir(&mut self) -> PathBuf { self.delete_temp_dir = false; - self.work_dir.clone() + self.temp_dir.clone() } pub(crate) fn generate(self) -> PathBuf { @@ -222,9 +222,8 @@ impl<'a> Tarball<'a> { cmd.arg("generate") .arg("--image-dir") .arg(&this.image_dir) - .arg("--non-installed-overlay") - .arg(&this.overlay_dir) .arg(format!("--component-name={}", &component_name)); + this.non_bare_args(cmd); }) } @@ -236,14 +235,41 @@ impl<'a> Tarball<'a> { } self.run(|this, cmd| { - cmd.arg("combine") - .arg("--input-tarballs") - .arg(input_tarballs) - .arg("--non-installed-overlay") - .arg(&this.overlay_dir); + cmd.arg("combine").arg("--input-tarballs").arg(input_tarballs); + this.non_bare_args(cmd); }); } + pub(crate) fn bare(self) -> PathBuf { + self.run(|this, cmd| { + cmd.arg("tarball") + .arg("--input") + .arg(&this.image_dir) + .arg("--output") + .arg(crate::dist::distdir(this.builder).join(this.package_name())); + }) + } + + fn package_name(&self) -> String { + if let Some(target) = &self.target { + format!("{}-{}", self.pkgname, target) + } else { + self.pkgname.clone() + } + } + + fn non_bare_args(&self, cmd: &mut Command) { + cmd.arg("--rel-manifest-dir=rustlib") + .arg("--legacy-manifest-dirs=rustlib,cargo") + .arg(format!("--product-name={}", self.product_name)) + .arg(format!("--success-message={} installed.", self.component)) + .arg(format!("--package-name={}", self.package_name())) + .arg("--non-installed-overlay") + .arg(&self.overlay_dir) + .arg("--output-dir") + .arg(crate::dist::distdir(self.builder)); + } + fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> PathBuf { t!(std::fs::create_dir_all(&self.overlay_dir)); self.builder.create(&self.overlay_dir.join("version"), &self.overlay.version(self.builder)); @@ -256,32 +282,17 @@ impl<'a> Tarball<'a> { let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller); - let package_name = if let Some(target) = &self.target { - self.builder.info(&format!("Dist {} ({})", self.component, target)); - format!("{}-{}", self.pkgname, target) - } else { - self.builder.info(&format!("Dist {}", self.component)); - self.pkgname.clone() - }; - + let package_name = self.package_name(); + self.builder.info(&format!("Dist {}", package_name)); let _time = crate::util::timeit(self.builder); - let distdir = crate::dist::distdir(self.builder); build_cli(&self, &mut cmd); - cmd.arg("--rel-manifest-dir=rustlib") - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg(format!("--product-name={}", self.product_name)) - .arg(format!("--success-message={} installed.", self.component)) - .arg(format!("--package-name={}", package_name)) - .arg("--work-dir") - .arg(self.work_dir) - .arg("--output-dir") - .arg(&distdir); + cmd.arg("--work-dir").arg(&self.temp_dir); self.builder.run(&mut cmd); if self.delete_temp_dir { t!(std::fs::remove_dir_all(&self.temp_dir)); } - distdir.join(format!("{}.tar.gz", package_name)) + crate::dist::distdir(self.builder).join(format!("{}.tar.gz", package_name)) } } -- cgit 1.4.1-3-g733a5 From ae12a0c200da9a97d80d074e20bf4180fe4671b5 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 7 Dec 2020 17:23:26 +0100 Subject: bootstrap: avoid producing the rust tarball during dry runs --- src/bootstrap/dist.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 258483bf134..dddb9527ea1 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1288,6 +1288,11 @@ impl Step for Extended { let etc = builder.src.join("src/etc/installer"); + // Avoid producing tarballs during a dry run. + if builder.config.dry_run { + return; + } + // When rust-std package split from rustc, we needed to ensure that during // upgrades rustc was upgraded before rust-std. To avoid rustc clobbering // the std files during uninstall. To do this ensure that rustc comes -- cgit 1.4.1-3-g733a5 From 2c081769b09a876ecd3e9854f8cffc022ddc6b13 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 21 Dec 2020 18:04:58 +0100 Subject: bootstrap: use the normal compiler to build std --- src/bootstrap/dist.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index dddb9527ea1..6d9ee60f952 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1283,8 +1283,7 @@ impl Step for Extended { let analysis_installer = builder.ensure(Analysis { compiler, target }); let docs_installer = builder.ensure(Docs { host: target }); - let std_installer = - builder.ensure(Std { compiler: builder.compiler(stage, target), target }); + let std_installer = builder.ensure(Std { compiler, target }); let etc = builder.src.join("src/etc/installer"); -- cgit 1.4.1-3-g733a5 From 8736731f70be86b169a0dcc6a1900ccc05d2db85 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 23 Dec 2020 19:40:45 +0100 Subject: bootstrap: convert reproducible-artifacts to use Tarball --- src/bootstrap/dist.rs | 45 ++++----------------------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 6d9ee60f952..0a79d09b27f 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2034,47 +2034,10 @@ impl Step for ReproducibleArtifacts { } fn run(self, builder: &Builder<'_>) -> Self::Output { - let name = pkgname(builder, "reproducible-artifacts"); - let tmp = tmpdir(builder); + let path = builder.config.rust_profile_use.as_ref()?; - // Prepare the image. - let image = tmp.join("reproducible-artifacts-image"); - let _ = fs::remove_dir_all(&image); - - if let Some(path) = &builder.config.rust_profile_use { - builder.install(std::path::Path::new(path), &image, 0o644); - } else { - return None; - } - - // Prepare the overlay. - let overlay = tmp.join("reproducible-artifacts-overlay"); - let _ = fs::remove_dir_all(&overlay); - builder.create_dir(&overlay); - builder.create(&overlay.join("version"), &builder.rust_version()); - for file in &["COPYRIGHT", "LICENSE-APACHE", "LICENSE-MIT", "README.md"] { - builder.install(&builder.src.join(file), &overlay, 0o644); - } - - // Create the final tarball. - let mut cmd = rust_installer(builder); - cmd.arg("generate") - .arg("--product-name=Rust") - .arg("--rel-manifest-dir=rustlib") - .arg("--success-message=reproducible-artifacts installed.") - .arg("--image-dir") - .arg(&image) - .arg("--work-dir") - .arg(&tmpdir(builder)) - .arg("--output-dir") - .arg(&distdir(builder)) - .arg("--non-installed-overlay") - .arg(&overlay) - .arg(format!("--package-name={}-{}", name, self.target.triple)) - .arg("--legacy-manifest-dirs=rustlib,cargo") - .arg("--component-name=reproducible-artifacts"); - - builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, self.target.triple))) + let tarball = Tarball::new(builder, "reproducible-artifacts", &self.target.triple); + tarball.add_file(path, ".", 0o644); + Some(tarball.generate()) } } -- cgit 1.4.1-3-g733a5 From 82acbc8a49799868613a070085dc462f38ed78d5 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 24 Dec 2020 20:23:54 -0500 Subject: Document rustc_macros on nightly-rustc --- src/bootstrap/doc.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 8cacc2512ef..826ad2e23c8 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -500,18 +500,17 @@ impl Step for Rustc { let target = self.target; builder.info(&format!("Documenting stage{} compiler ({})", stage, target)); - // This is the intended out directory for compiler documentation. - let out = builder.compiler_doc_out(target); - t!(fs::create_dir_all(&out)); - - let compiler = builder.compiler(stage, builder.config.build); - if !builder.config.compiler_docs { builder.info("\tskipping - compiler/librustdoc docs disabled"); return; } + // This is the intended out directory for compiler documentation. + let out = builder.compiler_doc_out(target); + t!(fs::create_dir_all(&out)); + // Build rustc. + let compiler = builder.compiler(stage, builder.config.build); builder.ensure(compile::Rustc { compiler, target }); // This uses a shared directory so that librustdoc documentation gets @@ -521,6 +520,10 @@ impl Step for Rustc { // merging the search index, or generating local (relative) links. let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target.triple).join("doc"); t!(symlink_dir_force(&builder.config, &out, &out_dir)); + // Cargo puts proc macros in `target/doc` even if you pass `--target` + // explicitly (https://github.com/rust-lang/cargo/issues/7677). + let proc_macro_out_dir = builder.stage_out(compiler, Mode::Rustc).join("doc"); + t!(symlink_dir_force(&builder.config, &out, &proc_macro_out_dir)); // Build cargo command. let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc"); -- cgit 1.4.1-3-g733a5 From fe52a6518628cd026a8c7e64c59183ca3c4b9144 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 26 Dec 2020 17:15:20 -0500 Subject: Use package name for top-level directory in bare tarballs This fixes a bug introduced by #79788. --- src/bootstrap/tarball.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 5d73a655427..32c8e791bfc 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -241,10 +241,16 @@ impl<'a> Tarball<'a> { } pub(crate) fn bare(self) -> PathBuf { + // Bare tarballs should have the top level directory match the package + // name, not "image". We rename the image directory just before passing + // into rust-installer. + let dest = self.temp_dir.join(self.package_name()); + t!(std::fs::rename(&self.image_dir, &dest)); + self.run(|this, cmd| { cmd.arg("tarball") .arg("--input") - .arg(&this.image_dir) + .arg(&dest) .arg("--output") .arg(crate::dist::distdir(this.builder).join(this.package_name())); }) -- cgit 1.4.1-3-g733a5 From 7ac02bddc7349fb2268c88e0adc4a0f1854fb531 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 26 Dec 2020 23:07:11 -0500 Subject: Don't give an error when creating a file for the first time Previously, `os.remove` would always give a FileNotFound error the first time you called it, causing bootstrap to make unnecessary copies. This now only calls `remove()` if the file exists, avoiding the unnecessary error. --- src/bootstrap/bootstrap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 97f40815b87..b8bae69d063 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -351,11 +351,13 @@ def output(filepath): with open(tmp, 'w') as f: yield f try: - os.remove(filepath) # PermissionError/OSError on Win32 if in use - os.rename(tmp, filepath) + if os.path.exists(filepath): + os.remove(filepath) # PermissionError/OSError on Win32 if in use except OSError: shutil.copy2(tmp, filepath) os.remove(tmp) + return + os.rename(tmp, filepath) class RustBuild(object): -- cgit 1.4.1-3-g733a5 From f994f1e884c13132c2a8ad7b5971d63b6b2fb47b Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 28 Dec 2020 12:51:58 +0100 Subject: bootstrap: put the component name in the tarball temp dir path This should not matter right now, but if we ever parallelize rustbuild this will avoid tarball contents being merged together. --- src/bootstrap/tarball.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 5d73a655427..3c2e3645a64 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -112,7 +112,7 @@ impl<'a> Tarball<'a> { fn new_inner(builder: &'a Builder<'a>, component: &str, target: Option) -> Self { let pkgname = crate::dist::pkgname(builder, component); - let mut temp_dir = builder.out.join("tmp").join("tarball"); + let mut temp_dir = builder.out.join("tmp").join("tarball").join(component); if let Some(target) = &target { temp_dir = temp_dir.join(target); } -- cgit 1.4.1-3-g733a5 From 8041ccff2c3a754fd199fbc9988b9cda996ba9c1 Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Mon, 28 Dec 2020 15:57:53 -0800 Subject: Add llvm-libunwind change to bootstrap CHANGELOG From #77703. --- src/bootstrap/CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/CHANGELOG.md b/src/bootstrap/CHANGELOG.md index a103c9fb0b7..f899f21080e 100644 --- a/src/bootstrap/CHANGELOG.md +++ b/src/bootstrap/CHANGELOG.md @@ -4,7 +4,12 @@ All notable changes to bootstrap will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [Non-breaking changes since the last major version] + +## [Changes since the last major version] + +- `llvm-libunwind` now accepts `in-tree` (formerly true), `system` or `no` (formerly false) [#77703](https://github.com/rust-lang/rust/pull/77703) + +### Non-breaking changes - `x.py check` needs opt-in to check tests (--all-targets) [#77473](https://github.com/rust-lang/rust/pull/77473) - The default bootstrap profiles are now located at `bootstrap/defaults/config.$PROFILE.toml` (previously they were located at `bootstrap/defaults/config.toml.$PROFILE`) [#77558](https://github.com/rust-lang/rust/pull/77558) -- cgit 1.4.1-3-g733a5 From 0a2034dca46f72d24d94c04b47c48d30149693bd Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 14 Dec 2020 15:53:07 +0100 Subject: bootstrap: add the dist.compression-formats option The option allows to add or remove compression formats used while producing dist tarballs. --- config.toml.example | 4 ++++ src/bootstrap/config.rs | 3 +++ src/bootstrap/configure.py | 4 ++++ src/bootstrap/tarball.rs | 16 +++++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/config.toml.example b/config.toml.example index b1fb8904ca9..9e08ce9b27e 100644 --- a/config.toml.example +++ b/config.toml.example @@ -669,3 +669,7 @@ changelog-seen = 2 # Whether to allow failures when building tools #missing-tools = false + +# List of compression formats to use when generating dist tarballs. The list of +# formats is provided to rust-installer, which must support all of them. +#compression-formats = ["gz", "xz"] diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index def8f215436..8a3b936d80d 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -148,6 +148,7 @@ pub struct Config { pub dist_sign_folder: Option, pub dist_upload_addr: Option, pub dist_gpg_password_file: Option, + pub dist_compression_formats: Option>, // libstd features pub backtrace: bool, // support for RUST_BACKTRACE @@ -438,6 +439,7 @@ struct Dist { upload_addr: Option, src_tarball: Option, missing_tools: Option, + compression_formats: Option>, } #[derive(Deserialize)] @@ -936,6 +938,7 @@ impl Config { config.dist_sign_folder = t.sign_folder.map(PathBuf::from); config.dist_gpg_password_file = t.gpg_password_file.map(PathBuf::from); config.dist_upload_addr = t.upload_addr; + config.dist_compression_formats = t.compression_formats; set(&mut config.rust_dist_src, t.src_tarball); set(&mut config.missing_tools, t.missing_tools); } diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 42f00ce9621..2cabaee68ea 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -147,6 +147,8 @@ v("experimental-targets", "llvm.experimental-targets", "experimental LLVM targets to build") v("release-channel", "rust.channel", "the name of the release channel to build") v("release-description", "rust.description", "optional descriptive string for version output") +v("dist-compression-formats", None, + "comma-separated list of compression formats to use") # Used on systems where "cc" is unavailable v("default-linker", "rust.default-linker", "the default linker") @@ -349,6 +351,8 @@ for key in known_args: elif option.name == 'option-checking': # this was handled above pass + elif option.name == 'dist-compression-formats': + set('dist.compression-formats', value.split(',')) else: raise RuntimeError("unhandled option {}".format(option.name)) diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 5d73a655427..a918677f2e5 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -288,11 +288,25 @@ impl<'a> Tarball<'a> { build_cli(&self, &mut cmd); cmd.arg("--work-dir").arg(&self.temp_dir); + if let Some(formats) = &self.builder.config.dist_compression_formats { + assert!(!formats.is_empty(), "dist.compression-formats can't be empty"); + cmd.arg("--compression-formats").arg(formats.join(",")); + } self.builder.run(&mut cmd); if self.delete_temp_dir { t!(std::fs::remove_dir_all(&self.temp_dir)); } - crate::dist::distdir(self.builder).join(format!("{}.tar.gz", package_name)) + // Use either the first compression format defined, or "gz" as the default. + let ext = self + .builder + .config + .dist_compression_formats + .as_ref() + .and_then(|formats| formats.get(0)) + .map(|s| s.as_str()) + .unwrap_or("gz"); + + crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)) } } -- cgit 1.4.1-3-g733a5 From 4d2d0bad4e51d0d14d21b4e21cdb61b55dd11349 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 28 Dec 2020 20:15:16 +0300 Subject: Remove `compile-fail` test suite --- compiler/rustc_hir/src/hir.rs | 2 +- compiler/rustc_incremental/src/assert_dep_graph.rs | 2 +- compiler/rustc_interface/src/passes.rs | 2 +- compiler/rustc_interface/src/queries.rs | 4 +- compiler/rustc_mir/src/transform/rustc_peek.rs | 2 +- compiler/rustc_resolve/src/build_reduced_graph.rs | 2 +- compiler/rustc_trait_selection/src/infer.rs | 2 +- .../src/traits/select/candidate_assembly.rs | 2 +- compiler/rustc_typeck/src/collect.rs | 3 +- src/bootstrap/README.md | 1 - src/bootstrap/builder.rs | 1 - src/bootstrap/mk/Makefile.in | 4 +- src/bootstrap/test.rs | 6 --- src/ci/docker/host-x86_64/test-various/Dockerfile | 1 - src/etc/generate-deriving-span-tests.py | 2 +- src/test/compile-fail/asm-src-loc-codegen-units.rs | 10 ---- src/test/compile-fail/asm-src-loc.rs | 9 ---- src/test/compile-fail/auxiliary/crateresolve1-1.rs | 5 -- src/test/compile-fail/auxiliary/crateresolve1-2.rs | 5 -- src/test/compile-fail/auxiliary/crateresolve1-3.rs | 5 -- src/test/compile-fail/auxiliary/depends.rs | 8 --- .../compile-fail/auxiliary/needs-panic-runtime.rs | 6 --- .../auxiliary/panic-runtime-lang-items.rs | 15 ------ .../compile-fail/auxiliary/panic-runtime-unwind.rs | 17 ------ .../auxiliary/panic-runtime-unwind2.rs | 17 ------ src/test/compile-fail/auxiliary/some-panic-impl.rs | 11 ---- .../auxiliary/wants-panic-runtime-unwind.rs | 6 --- src/test/compile-fail/auxiliary/weak-lang-items.rs | 22 -------- .../coerce-unsafe-closure-to-unsafe-fn-ptr.rs | 5 -- src/test/compile-fail/coerce-unsafe-to-closure.rs | 4 -- src/test/compile-fail/consts/const-fn-error.rs | 21 -------- src/test/compile-fail/consts/issue-55878.rs | 7 --- src/test/compile-fail/crateresolve1.rs | 9 ---- src/test/compile-fail/empty-extern-arg.rs | 4 -- src/test/compile-fail/invalid-link-args.rs | 12 ----- src/test/compile-fail/issue-10755.rs | 5 -- src/test/compile-fail/issue-23595-1.rs | 14 ----- .../compile-fail/issue-27675-unchecked-bounds.rs | 19 ------- src/test/compile-fail/issue-43733-2.rs | 28 ---------- src/test/compile-fail/issue-44415.rs | 11 ---- .../issue-46209-private-enum-variant-reexport.rs | 41 --------------- src/test/compile-fail/issue-52443.rs | 14 ----- .../compile-fail/meta-expected-error-wrong-rev.rs | 16 ------ src/test/compile-fail/must_use-in-stdlib-traits.rs | 47 ----------------- src/test/compile-fail/not-utf8.bin | Bin 3036 -> 0 bytes src/test/compile-fail/not-utf8.rs | 5 -- src/test/compile-fail/panic-handler-missing.rs | 8 --- src/test/compile-fail/panic-handler-twice.rs | 18 ------- .../runtime-depend-on-needs-runtime.rs | 7 --- .../runtime-depend-on-needs-runtime.stderr | 4 -- .../compile-fail/specialization/issue-50452.rs | 22 -------- src/test/compile-fail/two-panic-runtimes.rs | 14 ----- .../compile-fail/unwind-tables-panic-required.rs | 10 ---- .../compile-fail/unwind-tables-target-required.rs | 11 ---- src/test/compile-fail/want-abort-got-unwind.rs | 7 --- src/test/compile-fail/want-abort-got-unwind2.rs | 8 --- src/test/compile-fail/weak-lang-item.rs | 11 ---- .../many-crates-but-no-match/Makefile | 7 ++- .../type-mismatch-same-crate-name/crateC.rs | 2 +- .../ui-fulldeps/dropck-tarena-cycle-checked.rs | 4 +- src/test/ui-fulldeps/dropck_tarena_sound_drop.rs | 2 +- src/test/ui/array-slice-vec/copy-out-of-array-1.rs | 2 +- ...sociated-types-projection-to-unrelated-trait.rs | 2 +- src/test/ui/associated-types/issue-23595-1.rs | 14 +++++ src/test/ui/associated-types/issue-23595-1.stderr | 16 ++++++ .../issue-27675-unchecked-bounds.rs | 19 +++++++ .../issue-27675-unchecked-bounds.stderr | 17 ++++++ .../coerce-unsafe-closure-to-unsafe-fn-ptr.rs | 5 ++ .../coerce-unsafe-closure-to-unsafe-fn-ptr.stderr | 11 ++++ src/test/ui/closures/coerce-unsafe-to-closure.rs | 4 ++ .../ui/closures/coerce-unsafe-to-closure.stderr | 11 ++++ src/test/ui/consts/const-fn-error.rs | 21 ++++++++ src/test/ui/consts/const-fn-error.stderr | 49 ++++++++++++++++++ src/test/ui/consts/issue-44415.rs | 11 ++++ src/test/ui/consts/issue-44415.stderr | 28 ++++++++++ src/test/ui/consts/issue-55878.rs | 8 +++ src/test/ui/consts/issue-55878.stderr | 25 +++++++++ .../ui/crate-loading/auxiliary/crateresolve1-1.rs | 5 ++ .../ui/crate-loading/auxiliary/crateresolve1-2.rs | 5 ++ .../ui/crate-loading/auxiliary/crateresolve1-3.rs | 5 ++ src/test/ui/crate-loading/crateresolve1.rs | 10 ++++ src/test/ui/dropck/dropck_trait_cycle_checked.rs | 2 +- src/test/ui/extern-flag/empty-extern-arg.rs | 4 ++ src/test/ui/extern-flag/empty-extern-arg.stderr | 4 ++ src/test/ui/fsu-moves-and-copies.rs | 2 +- .../closure-expected-type/README.md | 2 +- src/test/ui/issues/issue-26996.rs | 2 +- src/test/ui/issues/issue-27021.rs | 2 +- .../issues/issue-28498-ugeh-with-lifetime-param.rs | 2 +- .../issues/issue-28498-ugeh-with-passed-to-fn.rs | 2 +- .../ui/issues/issue-28498-ugeh-with-trait-bound.rs | 2 +- src/test/ui/issues/issue-43733.rs | 31 ----------- src/test/ui/issues/issue-43733.stderr | 19 ------- src/test/ui/issues/issue-49298.rs | 2 +- src/test/ui/linkage-attr/invalid-link-args.rs | 14 +++++ src/test/ui/linkage-attr/issue-10755.rs | 7 +++ src/test/ui/lint/must_use-in-stdlib-traits.rs | 47 +++++++++++++++++ src/test/ui/lint/must_use-in-stdlib-traits.stderr | 47 +++++++++++++++++ src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs | 12 +++++ src/test/ui/llvm-asm/asm-src-loc.rs | 11 ++++ src/test/ui/macros/macro-comma-behavior-rpass.rs | 28 +++++----- .../ui/macros/macro-comma-behavior.core.stderr | 14 +++-- src/test/ui/macros/macro-comma-behavior.rs | 20 +++----- src/test/ui/macros/macro-comma-behavior.std.stderr | 30 ++++++++--- src/test/ui/macros/macro-comma-support-rpass.rs | 2 +- src/test/ui/macros/not-utf8.bin | Bin 0 -> 3036 bytes src/test/ui/macros/not-utf8.rs | 5 ++ src/test/ui/macros/not-utf8.stderr | 10 ++++ .../ui/meta/meta-expected-error-wrong-rev.a.stderr | 16 ++++++ src/test/ui/meta/meta-expected-error-wrong-rev.rs | 16 ++++++ src/test/ui/never_type/issue-52443.rs | 14 +++++ src/test/ui/never_type/issue-52443.stderr | 57 +++++++++++++++++++++ .../ui/object-lifetime-default-from-rptr-box.rs | 2 +- .../ui/panic-handler/auxiliary/weak-lang-items.rs | 22 ++++++++ src/test/ui/panic-handler/panic-handler-missing.rs | 9 ++++ src/test/ui/panic-handler/panic-handler-twice.rs | 19 +++++++ src/test/ui/panic-handler/weak-lang-item.rs | 11 ++++ src/test/ui/panic-handler/weak-lang-item.stderr | 19 +++++++ src/test/ui/panic-runtime/auxiliary/depends.rs | 8 +++ .../panic-runtime/auxiliary/needs-panic-runtime.rs | 6 +++ .../runtime-depend-on-needs-runtime.rs | 8 +++ src/test/ui/panic-runtime/two-panic-runtimes.rs | 16 ++++++ .../panic-runtime/unwind-tables-panic-required.rs | 11 ++++ .../panic-runtime/unwind-tables-target-required.rs | 11 ++++ src/test/ui/panic-runtime/want-abort-got-unwind.rs | 9 ++++ .../ui/panic-runtime/want-abort-got-unwind2.rs | 10 ++++ .../issue-46209-private-enum-variant-reexport.rs | 41 +++++++++++++++ ...ssue-46209-private-enum-variant-reexport.stderr | 44 ++++++++++++++++ .../ui/regions/regions-early-bound-trait-param.rs | 2 +- ...ons-variance-contravariant-use-contravariant.rs | 2 +- .../regions-variance-covariant-use-covariant.rs | 2 +- src/test/ui/span/dropck_arr_cycle_checked.rs | 2 +- src/test/ui/span/dropck_vec_cycle_checked.rs | 2 +- .../ui/specialization/defaultimpl/projection.rs | 2 +- src/test/ui/specialization/issue-50452-fail.rs | 21 ++++++++ src/test/ui/specialization/issue-50452-fail.stderr | 26 ++++++++++ .../ui/specialization/specialization-projection.rs | 2 +- .../ui/structs-enums/discrim-explicit-23030.rs | 2 +- .../object-lifetime-default-from-rptr-struct.rs | 2 +- src/test/ui/svh/auxiliary/svh-uta-base.rs | 2 +- .../ui/svh/auxiliary/svh-uta-change-use-trait.rs | 2 +- src/test/ui/svh/auxiliary/svh-utb.rs | 2 +- src/test/ui/svh/svh-use-trait.rs | 2 +- src/test/ui/threads-sendsync/issue-43733-2.rs | 30 +++++++++++ src/test/ui/threads-sendsync/issue-43733.rs | 31 +++++++++++ src/test/ui/threads-sendsync/issue-43733.stderr | 19 +++++++ src/test/ui/traits/traits-repeated-supertrait.rs | 2 +- src/test/ui/unsafe-fn-called-from-unsafe-blk.rs | 2 +- src/test/ui/unsafe-fn-called-from-unsafe-fn.rs | 2 +- src/tools/compiletest/src/common.rs | 8 +-- src/tools/compiletest/src/header.rs | 5 +- src/tools/compiletest/src/main.rs | 2 +- src/tools/compiletest/src/runtest.rs | 17 +++--- src/tools/tidy/src/features.rs | 6 +-- 154 files changed, 1013 insertions(+), 693 deletions(-) delete mode 100644 src/test/compile-fail/asm-src-loc-codegen-units.rs delete mode 100644 src/test/compile-fail/asm-src-loc.rs delete mode 100644 src/test/compile-fail/auxiliary/crateresolve1-1.rs delete mode 100644 src/test/compile-fail/auxiliary/crateresolve1-2.rs delete mode 100644 src/test/compile-fail/auxiliary/crateresolve1-3.rs delete mode 100644 src/test/compile-fail/auxiliary/depends.rs delete mode 100644 src/test/compile-fail/auxiliary/needs-panic-runtime.rs delete mode 100644 src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs delete mode 100644 src/test/compile-fail/auxiliary/panic-runtime-unwind.rs delete mode 100644 src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs delete mode 100644 src/test/compile-fail/auxiliary/some-panic-impl.rs delete mode 100644 src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs delete mode 100644 src/test/compile-fail/auxiliary/weak-lang-items.rs delete mode 100644 src/test/compile-fail/coerce-unsafe-closure-to-unsafe-fn-ptr.rs delete mode 100644 src/test/compile-fail/coerce-unsafe-to-closure.rs delete mode 100644 src/test/compile-fail/consts/const-fn-error.rs delete mode 100644 src/test/compile-fail/consts/issue-55878.rs delete mode 100644 src/test/compile-fail/crateresolve1.rs delete mode 100644 src/test/compile-fail/empty-extern-arg.rs delete mode 100644 src/test/compile-fail/invalid-link-args.rs delete mode 100644 src/test/compile-fail/issue-10755.rs delete mode 100644 src/test/compile-fail/issue-23595-1.rs delete mode 100644 src/test/compile-fail/issue-27675-unchecked-bounds.rs delete mode 100644 src/test/compile-fail/issue-43733-2.rs delete mode 100644 src/test/compile-fail/issue-44415.rs delete mode 100644 src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs delete mode 100644 src/test/compile-fail/issue-52443.rs delete mode 100644 src/test/compile-fail/meta-expected-error-wrong-rev.rs delete mode 100644 src/test/compile-fail/must_use-in-stdlib-traits.rs delete mode 100644 src/test/compile-fail/not-utf8.bin delete mode 100644 src/test/compile-fail/not-utf8.rs delete mode 100644 src/test/compile-fail/panic-handler-missing.rs delete mode 100644 src/test/compile-fail/panic-handler-twice.rs delete mode 100644 src/test/compile-fail/runtime-depend-on-needs-runtime.rs delete mode 100644 src/test/compile-fail/runtime-depend-on-needs-runtime.stderr delete mode 100644 src/test/compile-fail/specialization/issue-50452.rs delete mode 100644 src/test/compile-fail/two-panic-runtimes.rs delete mode 100644 src/test/compile-fail/unwind-tables-panic-required.rs delete mode 100644 src/test/compile-fail/unwind-tables-target-required.rs delete mode 100644 src/test/compile-fail/want-abort-got-unwind.rs delete mode 100644 src/test/compile-fail/want-abort-got-unwind2.rs delete mode 100644 src/test/compile-fail/weak-lang-item.rs create mode 100644 src/test/ui/associated-types/issue-23595-1.rs create mode 100644 src/test/ui/associated-types/issue-23595-1.stderr create mode 100644 src/test/ui/associated-types/issue-27675-unchecked-bounds.rs create mode 100644 src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr create mode 100644 src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs create mode 100644 src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr create mode 100644 src/test/ui/closures/coerce-unsafe-to-closure.rs create mode 100644 src/test/ui/closures/coerce-unsafe-to-closure.stderr create mode 100644 src/test/ui/consts/const-fn-error.rs create mode 100644 src/test/ui/consts/const-fn-error.stderr create mode 100644 src/test/ui/consts/issue-44415.rs create mode 100644 src/test/ui/consts/issue-44415.stderr create mode 100644 src/test/ui/consts/issue-55878.rs create mode 100644 src/test/ui/consts/issue-55878.stderr create mode 100644 src/test/ui/crate-loading/auxiliary/crateresolve1-1.rs create mode 100644 src/test/ui/crate-loading/auxiliary/crateresolve1-2.rs create mode 100644 src/test/ui/crate-loading/auxiliary/crateresolve1-3.rs create mode 100644 src/test/ui/crate-loading/crateresolve1.rs create mode 100644 src/test/ui/extern-flag/empty-extern-arg.rs create mode 100644 src/test/ui/extern-flag/empty-extern-arg.stderr delete mode 100644 src/test/ui/issues/issue-43733.rs delete mode 100644 src/test/ui/issues/issue-43733.stderr create mode 100644 src/test/ui/linkage-attr/invalid-link-args.rs create mode 100644 src/test/ui/linkage-attr/issue-10755.rs create mode 100644 src/test/ui/lint/must_use-in-stdlib-traits.rs create mode 100644 src/test/ui/lint/must_use-in-stdlib-traits.stderr create mode 100644 src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs create mode 100644 src/test/ui/llvm-asm/asm-src-loc.rs create mode 100644 src/test/ui/macros/not-utf8.bin create mode 100644 src/test/ui/macros/not-utf8.rs create mode 100644 src/test/ui/macros/not-utf8.stderr create mode 100644 src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr create mode 100644 src/test/ui/meta/meta-expected-error-wrong-rev.rs create mode 100644 src/test/ui/never_type/issue-52443.rs create mode 100644 src/test/ui/never_type/issue-52443.stderr create mode 100644 src/test/ui/panic-handler/auxiliary/weak-lang-items.rs create mode 100644 src/test/ui/panic-handler/panic-handler-missing.rs create mode 100644 src/test/ui/panic-handler/panic-handler-twice.rs create mode 100644 src/test/ui/panic-handler/weak-lang-item.rs create mode 100644 src/test/ui/panic-handler/weak-lang-item.stderr create mode 100644 src/test/ui/panic-runtime/auxiliary/depends.rs create mode 100644 src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs create mode 100644 src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs create mode 100644 src/test/ui/panic-runtime/two-panic-runtimes.rs create mode 100644 src/test/ui/panic-runtime/unwind-tables-panic-required.rs create mode 100644 src/test/ui/panic-runtime/unwind-tables-target-required.rs create mode 100644 src/test/ui/panic-runtime/want-abort-got-unwind.rs create mode 100644 src/test/ui/panic-runtime/want-abort-got-unwind2.rs create mode 100644 src/test/ui/privacy/issue-46209-private-enum-variant-reexport.rs create mode 100644 src/test/ui/privacy/issue-46209-private-enum-variant-reexport.stderr create mode 100644 src/test/ui/specialization/issue-50452-fail.rs create mode 100644 src/test/ui/specialization/issue-50452-fail.stderr create mode 100644 src/test/ui/threads-sendsync/issue-43733-2.rs create mode 100644 src/test/ui/threads-sendsync/issue-43733.rs create mode 100644 src/test/ui/threads-sendsync/issue-43733.stderr (limited to 'src/bootstrap') diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 2abebbd0303..23999a8dca0 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -607,7 +607,7 @@ pub struct Crate<'hir> { // over the ids in increasing order. In principle it should not // matter what order we visit things in, but in *practice* it // does, because it can affect the order in which errors are - // detected, which in turn can make compile-fail tests yield + // detected, which in turn can make UI tests yield // slightly different results. pub items: BTreeMap>, diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs index e17396422f1..9b4388c911f 100644 --- a/compiler/rustc_incremental/src/assert_dep_graph.rs +++ b/compiler/rustc_incremental/src/assert_dep_graph.rs @@ -12,7 +12,7 @@ //! In this code, we report errors on each `rustc_if_this_changed` //! annotation. If a path exists in all cases, then we would report //! "all path(s) exist". Otherwise, we report: "no path to `foo`" for -//! each case where no path exists. `compile-fail` tests can then be +//! each case where no path exists. `ui` tests can then be //! used to check when paths exist or do not. //! //! The full form of the `rustc_if_this_changed` annotation is diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 1a2af48b38d..461ee085922 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -889,7 +889,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> { // Avoid overwhelming user with errors if borrow checking failed. // I'm not sure how helpful this is, to be honest, but it avoids a - // lot of annoying errors in the compile-fail tests (basically, + // lot of annoying errors in the ui tests (basically, // lint warnings and so on -- kindck used to do this abort, but // kindck is gone now). -nmatsakis if sess.has_errors() { diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 2384927b301..9c49f926d41 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -280,7 +280,7 @@ impl<'tcx> Queries<'tcx> { // Don't do code generation if there were any errors self.session().compile_status()?; - // Hook for compile-fail tests. + // Hook for UI tests. Self::check_for_rustc_errors_attr(tcx); Ok(passes::start_codegen(&***self.codegen_backend(), tcx, &*outputs.peek())) @@ -289,7 +289,7 @@ impl<'tcx> Queries<'tcx> { } /// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used - /// to write compile-fail tests that actually test that compilation succeeds without reporting + /// to write UI tests that actually test that compilation succeeds without reporting /// an error. fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) { let def_id = match tcx.entry_fn(LOCAL_CRATE) { diff --git a/compiler/rustc_mir/src/transform/rustc_peek.rs b/compiler/rustc_mir/src/transform/rustc_peek.rs index 205f718d6e4..7598be4e4a1 100644 --- a/compiler/rustc_mir/src/transform/rustc_peek.rs +++ b/compiler/rustc_mir/src/transform/rustc_peek.rs @@ -92,7 +92,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck { /// "rustc_peek: bit not set". /// /// The intention is that one can write unit tests for dataflow by -/// putting code into a compile-fail test and using `rustc_peek` to +/// putting code into an UI test and using `rustc_peek` to /// make observations about the results of dataflow static analyses. /// /// (If there are any calls to `rustc_peek` that do not match the diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 06e9969697d..a5adfb27e93 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -525,7 +525,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { ModuleKind::Block(..) => unreachable!(), }; // HACK(eddyb) unclear how good this is, but keeping `$crate` - // in `source` breaks `src/test/compile-fail/import-crate-var.rs`, + // in `source` breaks `src/test/ui/imports/import-crate-var.rs`, // while the current crate doesn't have a valid `crate_name`. if crate_name != kw::Invalid { // `crate_name` should not be interpreted as relative. diff --git a/compiler/rustc_trait_selection/src/infer.rs b/compiler/rustc_trait_selection/src/infer.rs index 41184ce2116..da66fbc8587 100644 --- a/compiler/rustc_trait_selection/src/infer.rs +++ b/compiler/rustc_trait_selection/src/infer.rs @@ -162,7 +162,7 @@ impl<'tcx> OutlivesEnvironmentExt<'tcx> for OutlivesEnvironment<'tcx> { /// 'b` (and hence, transitively, that `T: 'a`). This method would /// add those assumptions into the outlives-environment. /// - /// Tests: `src/test/compile-fail/regions-free-region-ordering-*.rs` + /// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs` fn add_implied_bounds( &mut self, infcx: &InferCtxt<'a, 'tcx>, diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index ca3369b8f1e..12029f7bc75 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -558,7 +558,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // where-clause or, in the case of an object type, // it could be that the object type lists the // trait (e.g., `Foo+Send : Send`). See - // `compile-fail/typeck-default-trait-impl-send-param.rs` + // `ui/typeck/typeck-default-trait-impl-send-param.rs` // for an example of a test case that exercises // this path. } diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 29b03d118e2..3e40f5ba28a 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -1767,8 +1767,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP const NO_GENERICS: &hir::Generics<'_> = &hir::Generics::empty(); // We use an `IndexSet` to preserves order of insertion. - // Preserving the order of insertion is important here so as not to break - // compile-fail UI tests. + // Preserving the order of insertion is important here so as not to break UI tests. let mut predicates: FxIndexSet<(ty::Predicate<'_>, Span)> = FxIndexSet::default(); let ast_generics = match node { diff --git a/src/bootstrap/README.md b/src/bootstrap/README.md index 84ed9446ae7..a2e596bf4e9 100644 --- a/src/bootstrap/README.md +++ b/src/bootstrap/README.md @@ -201,7 +201,6 @@ build/ # Output for all compiletest-based test suites test/ ui/ - compile-fail/ debuginfo/ ... diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 0fdafa39386..c271608a6b6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -384,7 +384,6 @@ impl<'a> Builder<'a> { test::ExpandYamlAnchors, test::Tidy, test::Ui, - test::CompileFail, test::RunPassValgrind, test::MirOpt, test::Codegen, diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 1564cfb0619..fd39944e176 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -66,7 +66,6 @@ check-stage2-T-x86_64-unknown-linux-musl-H-x86_64-unknown-linux-gnu: TESTS_IN_2 := \ src/test/ui \ - src/test/compile-fail \ src/tools/linkchecker ci-subset-1: @@ -75,8 +74,7 @@ ci-subset-2: $(Q)$(BOOTSTRAP) test --stage 2 $(TESTS_IN_2) TESTS_IN_MINGW_2 := \ - src/test/ui \ - src/test/compile-fail + src/test/ui ci-mingw-subset-1: $(Q)$(BOOTSTRAP) test --stage 2 $(TESTS_IN_MINGW_2:%=--exclude %) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index b99692e8ba5..859236804d3 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -869,12 +869,6 @@ default_test_with_compare_mode!(Ui { compare_mode: "nll" }); -default_test!(CompileFail { - path: "src/test/compile-fail", - mode: "compile-fail", - suite: "compile-fail" -}); - default_test!(RunPassValgrind { path: "src/test/run-pass-valgrind", mode: "run-pass-valgrind", diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 8653aecc12c..147de5f8015 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -44,7 +44,6 @@ ENV WASM_TARGETS=wasm32-unknown-unknown ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS \ src/test/run-make \ src/test/ui \ - src/test/compile-fail \ src/test/mir-opt \ src/test/codegen-units \ library/core diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index a0ba47e1dbe..d38f5add747 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -This script creates a pile of compile-fail tests check that all the +This script creates a pile of UI tests check that all the derives have spans that point to the fields, rather than the #[derive(...)] line. diff --git a/src/test/compile-fail/asm-src-loc-codegen-units.rs b/src/test/compile-fail/asm-src-loc-codegen-units.rs deleted file mode 100644 index 5b8690c3b98..00000000000 --- a/src/test/compile-fail/asm-src-loc-codegen-units.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags: -C codegen-units=2 -// ignore-emscripten - -#![feature(llvm_asm)] - -fn main() { - unsafe { - llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction - } -} diff --git a/src/test/compile-fail/asm-src-loc.rs b/src/test/compile-fail/asm-src-loc.rs deleted file mode 100644 index 7c87f370d4f..00000000000 --- a/src/test/compile-fail/asm-src-loc.rs +++ /dev/null @@ -1,9 +0,0 @@ -// ignore-emscripten - -#![feature(llvm_asm)] - -fn main() { - unsafe { - llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction - } -} diff --git a/src/test/compile-fail/auxiliary/crateresolve1-1.rs b/src/test/compile-fail/auxiliary/crateresolve1-1.rs deleted file mode 100644 index a00a19e46d5..00000000000 --- a/src/test/compile-fail/auxiliary/crateresolve1-1.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags:-C extra-filename=-1 -#![crate_name = "crateresolve1"] -#![crate_type = "lib"] - -pub fn f() -> isize { 10 } diff --git a/src/test/compile-fail/auxiliary/crateresolve1-2.rs b/src/test/compile-fail/auxiliary/crateresolve1-2.rs deleted file mode 100644 index 71cc0a12ea3..00000000000 --- a/src/test/compile-fail/auxiliary/crateresolve1-2.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags:-C extra-filename=-2 -#![crate_name = "crateresolve1"] -#![crate_type = "lib"] - -pub fn f() -> isize { 20 } diff --git a/src/test/compile-fail/auxiliary/crateresolve1-3.rs b/src/test/compile-fail/auxiliary/crateresolve1-3.rs deleted file mode 100644 index 921687d4c3b..00000000000 --- a/src/test/compile-fail/auxiliary/crateresolve1-3.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags:-C extra-filename=-3 -#![crate_name = "crateresolve1"] -#![crate_type = "lib"] - -pub fn f() -> isize { 30 } diff --git a/src/test/compile-fail/auxiliary/depends.rs b/src/test/compile-fail/auxiliary/depends.rs deleted file mode 100644 index e9bc2f4893e..00000000000 --- a/src/test/compile-fail/auxiliary/depends.rs +++ /dev/null @@ -1,8 +0,0 @@ -// no-prefer-dynamic - -#![feature(panic_runtime)] -#![crate_type = "rlib"] -#![panic_runtime] -#![no_std] - -extern crate needs_panic_runtime; diff --git a/src/test/compile-fail/auxiliary/needs-panic-runtime.rs b/src/test/compile-fail/auxiliary/needs-panic-runtime.rs deleted file mode 100644 index 3f030c169f6..00000000000 --- a/src/test/compile-fail/auxiliary/needs-panic-runtime.rs +++ /dev/null @@ -1,6 +0,0 @@ -// no-prefer-dynamic - -#![feature(needs_panic_runtime)] -#![crate_type = "rlib"] -#![needs_panic_runtime] -#![no_std] diff --git a/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs b/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs deleted file mode 100644 index b9ef2f32941..00000000000 --- a/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs +++ /dev/null @@ -1,15 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] - -#![no_std] -#![feature(lang_items)] - -use core::panic::PanicInfo; - -#[lang = "panic_impl"] -fn panic_impl(info: &PanicInfo) -> ! { loop {} } -#[lang = "eh_personality"] -fn eh_personality() {} -#[lang = "eh_catch_typeinfo"] -static EH_CATCH_TYPEINFO: u8 = 0; diff --git a/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs b/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs deleted file mode 100644 index 97452a342ab..00000000000 --- a/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs +++ /dev/null @@ -1,17 +0,0 @@ -// compile-flags:-C panic=unwind -// no-prefer-dynamic - -#![feature(panic_runtime)] -#![crate_type = "rlib"] - -#![no_std] -#![panic_runtime] - -#[no_mangle] -pub extern fn __rust_maybe_catch_panic() {} - -#[no_mangle] -pub extern fn __rust_start_panic() {} - -#[no_mangle] -pub extern fn rust_eh_personality() {} diff --git a/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs b/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs deleted file mode 100644 index 97452a342ab..00000000000 --- a/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs +++ /dev/null @@ -1,17 +0,0 @@ -// compile-flags:-C panic=unwind -// no-prefer-dynamic - -#![feature(panic_runtime)] -#![crate_type = "rlib"] - -#![no_std] -#![panic_runtime] - -#[no_mangle] -pub extern fn __rust_maybe_catch_panic() {} - -#[no_mangle] -pub extern fn __rust_start_panic() {} - -#[no_mangle] -pub extern fn rust_eh_personality() {} diff --git a/src/test/compile-fail/auxiliary/some-panic-impl.rs b/src/test/compile-fail/auxiliary/some-panic-impl.rs deleted file mode 100644 index 0348b3a2d76..00000000000 --- a/src/test/compile-fail/auxiliary/some-panic-impl.rs +++ /dev/null @@ -1,11 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![no_std] - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(info: &PanicInfo) -> ! { - loop {} -} diff --git a/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs b/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs deleted file mode 100644 index d5f0102196f..00000000000 --- a/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs +++ /dev/null @@ -1,6 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![no_std] - -extern crate panic_runtime_unwind; diff --git a/src/test/compile-fail/auxiliary/weak-lang-items.rs b/src/test/compile-fail/auxiliary/weak-lang-items.rs deleted file mode 100644 index 7a698cf76ae..00000000000 --- a/src/test/compile-fail/auxiliary/weak-lang-items.rs +++ /dev/null @@ -1,22 +0,0 @@ -// no-prefer-dynamic - -// This aux-file will require the eh_personality function to be codegen'd, but -// it hasn't been defined just yet. Make sure we don't explode. - -#![no_std] -#![crate_type = "rlib"] - -struct A; - -impl core::ops::Drop for A { - fn drop(&mut self) {} -} - -pub fn foo() { - let _a = A; - panic!("wut"); -} - -mod std { - pub use core::{option, fmt}; -} diff --git a/src/test/compile-fail/coerce-unsafe-closure-to-unsafe-fn-ptr.rs b/src/test/compile-fail/coerce-unsafe-closure-to-unsafe-fn-ptr.rs deleted file mode 100644 index 36777693fab..00000000000 --- a/src/test/compile-fail/coerce-unsafe-closure-to-unsafe-fn-ptr.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; - //~^ ERROR E0133 - let _: unsafe fn() = || unsafe { ::std::pin::Pin::new_unchecked(&0_u8); }; // OK -} diff --git a/src/test/compile-fail/coerce-unsafe-to-closure.rs b/src/test/compile-fail/coerce-unsafe-to-closure.rs deleted file mode 100644 index 78bdd36f9cc..00000000000 --- a/src/test/compile-fail/coerce-unsafe-to-closure.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); - //~^ ERROR E0277 -} diff --git a/src/test/compile-fail/consts/const-fn-error.rs b/src/test/compile-fail/consts/const-fn-error.rs deleted file mode 100644 index 68a4d414ff3..00000000000 --- a/src/test/compile-fail/consts/const-fn-error.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(const_fn)] - -const X : usize = 2; - -const fn f(x: usize) -> usize { - let mut sum = 0; - for i in 0..x { - //~^ ERROR mutable references - //~| ERROR calls in constant functions - //~| ERROR calls in constant functions - //~| ERROR E0080 - //~| ERROR E0744 - sum += i; - } - sum -} - -#[allow(unused_variables)] -fn main() { - let a : [i32; f(X)]; -} diff --git a/src/test/compile-fail/consts/issue-55878.rs b/src/test/compile-fail/consts/issue-55878.rs deleted file mode 100644 index fee664caa17..00000000000 --- a/src/test/compile-fail/consts/issue-55878.rs +++ /dev/null @@ -1,7 +0,0 @@ -// normalize-stderr-64bit "18446744073709551615" -> "SIZE" -// normalize-stderr-32bit "4294967295" -> "SIZE" - -// error-pattern: are too big for the current architecture -fn main() { - println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); -} diff --git a/src/test/compile-fail/crateresolve1.rs b/src/test/compile-fail/crateresolve1.rs deleted file mode 100644 index 453c8d97622..00000000000 --- a/src/test/compile-fail/crateresolve1.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:crateresolve1-1.rs -// aux-build:crateresolve1-2.rs -// aux-build:crateresolve1-3.rs -// error-pattern:multiple matching crates for `crateresolve1` - -extern crate crateresolve1; - -fn main() { -} diff --git a/src/test/compile-fail/empty-extern-arg.rs b/src/test/compile-fail/empty-extern-arg.rs deleted file mode 100644 index d3cb5aaaeba..00000000000 --- a/src/test/compile-fail/empty-extern-arg.rs +++ /dev/null @@ -1,4 +0,0 @@ -// compile-flags: --extern std= -// error-pattern: extern location for std does not exist - -fn main() {} diff --git a/src/test/compile-fail/invalid-link-args.rs b/src/test/compile-fail/invalid-link-args.rs deleted file mode 100644 index 1e68b4f8b70..00000000000 --- a/src/test/compile-fail/invalid-link-args.rs +++ /dev/null @@ -1,12 +0,0 @@ -// ignore-msvc due to linker-flavor=ld -// error-pattern:aFdEfSeVEEE -// compile-flags: -C linker-flavor=ld - -/* Make sure invalid link_args are printed to stderr. */ - -#![feature(link_args)] - -#[link_args = "aFdEfSeVEEE"] -extern {} - -fn main() { } diff --git a/src/test/compile-fail/issue-10755.rs b/src/test/compile-fail/issue-10755.rs deleted file mode 100644 index 3c6fcddc0d2..00000000000 --- a/src/test/compile-fail/issue-10755.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags: -C linker=llllll -C linker-flavor=ld -// error-pattern: linker `llllll` not found - -fn main() { -} diff --git a/src/test/compile-fail/issue-23595-1.rs b/src/test/compile-fail/issue-23595-1.rs deleted file mode 100644 index 483c205f42d..00000000000 --- a/src/test/compile-fail/issue-23595-1.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(associated_type_defaults)] - -use std::ops::Index; - -trait Hierarchy { - type Value; - type ChildKey; - type Children = dyn Index; - //~^ ERROR: the value of the associated types - - fn data(&self) -> Option<(Self::Value, Self::Children)>; -} - -fn main() {} diff --git a/src/test/compile-fail/issue-27675-unchecked-bounds.rs b/src/test/compile-fail/issue-27675-unchecked-bounds.rs deleted file mode 100644 index 1cfc2304531..00000000000 --- a/src/test/compile-fail/issue-27675-unchecked-bounds.rs +++ /dev/null @@ -1,19 +0,0 @@ -/// The compiler previously did not properly check the bound of `From` when it was used from type -/// of the dyn trait object (use in `copy_any` below). Since the associated type is under user -/// control in this usage, the compiler could be tricked to believe any type implemented any trait. -/// This would ICE, except for pure marker traits like `Copy`. It did not require providing an -/// instance of the dyn trait type, only name said type. -trait Setup { - type From: Copy; -} - -fn copy(from: &U::From) -> U::From { - *from -} - -pub fn copy_any(t: &T) -> T { - copy::>(t) - //~^ ERROR the trait bound `T: Copy` is not satisfied -} - -fn main() {} diff --git a/src/test/compile-fail/issue-43733-2.rs b/src/test/compile-fail/issue-43733-2.rs deleted file mode 100644 index 61dd3a923f2..00000000000 --- a/src/test/compile-fail/issue-43733-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![feature(cfg_target_thread_local, thread_local_internals)] - -// On platforms *without* `#[thread_local]`, use -// a custom non-`Sync` type to fake the same error. -#[cfg(not(target_thread_local))] -struct Key { - _data: std::cell::UnsafeCell>, - _flag: std::cell::Cell<()>, -} - -#[cfg(not(target_thread_local))] -impl Key { - const fn new() -> Self { - Key { - _data: std::cell::UnsafeCell::new(None), - _flag: std::cell::Cell::new(()), - } - } -} - -#[cfg(target_thread_local)] -use std::thread::__FastLocalKeyInner as Key; - -static __KEY: Key<()> = Key::new(); -//~^ ERROR `UnsafeCell>` cannot be shared between threads -//~| ERROR cannot be shared between threads safely [E0277] - -fn main() {} diff --git a/src/test/compile-fail/issue-44415.rs b/src/test/compile-fail/issue-44415.rs deleted file mode 100644 index 71e764620d1..00000000000 --- a/src/test/compile-fail/issue-44415.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(core_intrinsics)] - -use std::intrinsics; - -struct Foo { - bytes: [u8; unsafe { intrinsics::size_of::() }], - //~^ ERROR cycle detected when simplifying constant for the type system - x: usize, -} - -fn main() {} diff --git a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs deleted file mode 100644 index d54c9931479..00000000000 --- a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs +++ /dev/null @@ -1,41 +0,0 @@ -#![feature(crate_visibility_modifier)] - -mod rank { - pub use self::Professor::*; - //~^ ERROR enum is private and its variants cannot be re-exported - pub use self::Lieutenant::{JuniorGrade, Full}; - //~^ ERROR variant `JuniorGrade` is private and cannot be re-exported - //~| ERROR variant `Full` is private and cannot be re-exported - pub use self::PettyOfficer::*; - //~^ ERROR enum is private and its variants cannot be re-exported - pub use self::Crewman::*; - //~^ ERROR enum is private and its variants cannot be re-exported - - enum Professor { - Adjunct, - Assistant, - Associate, - Full - } - - enum Lieutenant { - JuniorGrade, - Full, - } - - pub(in rank) enum PettyOfficer { - SecondClass, - FirstClass, - Chief, - MasterChief - } - - crate enum Crewman { - Recruit, - Apprentice, - Full - } - -} - -fn main() {} diff --git a/src/test/compile-fail/issue-52443.rs b/src/test/compile-fail/issue-52443.rs deleted file mode 100644 index 4519833b864..00000000000 --- a/src/test/compile-fail/issue-52443.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - [(); & { loop { continue } } ]; //~ ERROR mismatched types - - [(); loop { break }]; //~ ERROR mismatched types - - [(); {while true {break}; 0}]; - //~^ WARN denote infinite loops with - - [(); { for _ in 0usize.. {}; 0}]; - //~^ ERROR `for` is not allowed in a `const` - //~| ERROR calls in constants are limited to constant functions - //~| ERROR mutable references are not allowed in constants - //~| ERROR calls in constants are limited to constant functions -} diff --git a/src/test/compile-fail/meta-expected-error-wrong-rev.rs b/src/test/compile-fail/meta-expected-error-wrong-rev.rs deleted file mode 100644 index 7e49434142b..00000000000 --- a/src/test/compile-fail/meta-expected-error-wrong-rev.rs +++ /dev/null @@ -1,16 +0,0 @@ -// ignore-compare-mode-nll - -// revisions: a -// should-fail - -// This is a "meta-test" of the compilertest framework itself. In -// particular, it includes the right error message, but the message -// targets the wrong revision, so we expect the execution to fail. -// See also `meta-expected-error-correct-rev.rs`. - -#[cfg(a)] -fn foo() { - let x: u32 = 22_usize; //[b]~ ERROR mismatched types -} - -fn main() { } diff --git a/src/test/compile-fail/must_use-in-stdlib-traits.rs b/src/test/compile-fail/must_use-in-stdlib-traits.rs deleted file mode 100644 index 70dddf61fb7..00000000000 --- a/src/test/compile-fail/must_use-in-stdlib-traits.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![deny(unused_must_use)] -#![feature(arbitrary_self_types)] - -use std::iter::Iterator; -use std::future::Future; - -use std::task::{Context, Poll}; -use std::pin::Pin; -use std::unimplemented; - -struct MyFuture; - -impl Future for MyFuture { - type Output = u32; - - fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { - Poll::Pending - } -} - -fn iterator() -> impl Iterator { - std::iter::empty::() -} - -fn future() -> impl Future { - MyFuture -} - -fn square_fn_once() -> impl FnOnce(u32) -> u32 { - |x| x * x -} - -fn square_fn_mut() -> impl FnMut(u32) -> u32 { - |x| x * x -} - -fn square_fn() -> impl Fn(u32) -> u32 { - |x| x * x -} - -fn main() { - iterator(); //~ ERROR unused implementer of `Iterator` that must be used - future(); //~ ERROR unused implementer of `Future` that must be used - square_fn_once(); //~ ERROR unused implementer of `FnOnce` that must be used - square_fn_mut(); //~ ERROR unused implementer of `FnMut` that must be used - square_fn(); //~ ERROR unused implementer of `Fn` that must be used -} diff --git a/src/test/compile-fail/not-utf8.bin b/src/test/compile-fail/not-utf8.bin deleted file mode 100644 index 4148e5b88fe..00000000000 Binary files a/src/test/compile-fail/not-utf8.bin and /dev/null differ diff --git a/src/test/compile-fail/not-utf8.rs b/src/test/compile-fail/not-utf8.rs deleted file mode 100644 index 1cb1fdcb8c9..00000000000 --- a/src/test/compile-fail/not-utf8.rs +++ /dev/null @@ -1,5 +0,0 @@ -// error-pattern: did not contain valid UTF-8 - -fn foo() { - include!("not-utf8.bin") -} diff --git a/src/test/compile-fail/panic-handler-missing.rs b/src/test/compile-fail/panic-handler-missing.rs deleted file mode 100644 index 1c380c99c18..00000000000 --- a/src/test/compile-fail/panic-handler-missing.rs +++ /dev/null @@ -1,8 +0,0 @@ -// error-pattern: `#[panic_handler]` function required, but not found - -#![feature(lang_items)] -#![no_main] -#![no_std] - -#[lang = "eh_personality"] -fn eh() {} diff --git a/src/test/compile-fail/panic-handler-twice.rs b/src/test/compile-fail/panic-handler-twice.rs deleted file mode 100644 index 0c5359b9bd8..00000000000 --- a/src/test/compile-fail/panic-handler-twice.rs +++ /dev/null @@ -1,18 +0,0 @@ -// aux-build:some-panic-impl.rs - -#![feature(lang_items)] -#![no_std] -#![no_main] - -extern crate some_panic_impl; - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(info: &PanicInfo) -> ! { - //~^ ERROR found duplicate lang item `panic_impl` - loop {} -} - -#[lang = "eh_personality"] -fn eh() {} diff --git a/src/test/compile-fail/runtime-depend-on-needs-runtime.rs b/src/test/compile-fail/runtime-depend-on-needs-runtime.rs deleted file mode 100644 index 866c5b2e34b..00000000000 --- a/src/test/compile-fail/runtime-depend-on-needs-runtime.rs +++ /dev/null @@ -1,7 +0,0 @@ -// aux-build:needs-panic-runtime.rs -// aux-build:depends.rs -// error-pattern:cannot depend on a crate that needs a panic runtime - -extern crate depends; - -fn main() {} diff --git a/src/test/compile-fail/runtime-depend-on-needs-runtime.stderr b/src/test/compile-fail/runtime-depend-on-needs-runtime.stderr deleted file mode 100644 index 27e27dda5ef..00000000000 --- a/src/test/compile-fail/runtime-depend-on-needs-runtime.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime` - -error: aborting due to previous error - diff --git a/src/test/compile-fail/specialization/issue-50452.rs b/src/test/compile-fail/specialization/issue-50452.rs deleted file mode 100644 index 958f0eb2668..00000000000 --- a/src/test/compile-fail/specialization/issue-50452.rs +++ /dev/null @@ -1,22 +0,0 @@ -// compile-fail -#![feature(specialization)] -//~^ WARN the feature `specialization` is incomplete - -pub trait Foo { - fn foo(); -} - -impl Foo for i32 {} -impl Foo for i64 { - fn foo() {} - //~^ERROR `foo` specializes an item from a parent `impl` -} -impl Foo for T { - fn foo() {} -} - -fn main() { - i32::foo(); - i64::foo(); - u8::foo(); -} diff --git a/src/test/compile-fail/two-panic-runtimes.rs b/src/test/compile-fail/two-panic-runtimes.rs deleted file mode 100644 index 671d44564e6..00000000000 --- a/src/test/compile-fail/two-panic-runtimes.rs +++ /dev/null @@ -1,14 +0,0 @@ -// error-pattern:cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2 -// ignore-tidy-linelength -// aux-build:panic-runtime-unwind.rs -// aux-build:panic-runtime-unwind2.rs -// aux-build:panic-runtime-lang-items.rs - -#![no_std] -#![no_main] - -extern crate panic_runtime_unwind; -extern crate panic_runtime_unwind2; -extern crate panic_runtime_lang_items; - -fn main() {} diff --git a/src/test/compile-fail/unwind-tables-panic-required.rs b/src/test/compile-fail/unwind-tables-panic-required.rs deleted file mode 100644 index 314d9e778d5..00000000000 --- a/src/test/compile-fail/unwind-tables-panic-required.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Tests that the compiler errors if the user tries to turn off unwind tables -// when they are required. -// -// compile-flags: -C panic=unwind -C force-unwind-tables=no -// ignore-tidy-linelength -// -// error-pattern: panic=unwind requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`. - -pub fn main() { -} diff --git a/src/test/compile-fail/unwind-tables-target-required.rs b/src/test/compile-fail/unwind-tables-target-required.rs deleted file mode 100644 index 14c17893764..00000000000 --- a/src/test/compile-fail/unwind-tables-target-required.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Tests that the compiler errors if the user tries to turn off unwind tables -// when they are required. -// -// only-x86_64-windows-msvc -// compile-flags: -C force-unwind-tables=no -// ignore-tidy-linelength -// -// error-pattern: target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`. - -pub fn main() { -} diff --git a/src/test/compile-fail/want-abort-got-unwind.rs b/src/test/compile-fail/want-abort-got-unwind.rs deleted file mode 100644 index 30782e18229..00000000000 --- a/src/test/compile-fail/want-abort-got-unwind.rs +++ /dev/null @@ -1,7 +0,0 @@ -// error-pattern:is not compiled with this crate's panic strategy `abort` -// aux-build:panic-runtime-unwind.rs -// compile-flags:-C panic=abort - -extern crate panic_runtime_unwind; - -fn main() {} diff --git a/src/test/compile-fail/want-abort-got-unwind2.rs b/src/test/compile-fail/want-abort-got-unwind2.rs deleted file mode 100644 index 35d8d46b55e..00000000000 --- a/src/test/compile-fail/want-abort-got-unwind2.rs +++ /dev/null @@ -1,8 +0,0 @@ -// error-pattern:is not compiled with this crate's panic strategy `abort` -// aux-build:panic-runtime-unwind.rs -// aux-build:wants-panic-runtime-unwind.rs -// compile-flags:-C panic=abort - -extern crate wants_panic_runtime_unwind; - -fn main() {} diff --git a/src/test/compile-fail/weak-lang-item.rs b/src/test/compile-fail/weak-lang-item.rs deleted file mode 100644 index 3fa3822831b..00000000000 --- a/src/test/compile-fail/weak-lang-item.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:weak-lang-items.rs -// error-pattern: `#[panic_handler]` function required, but not found -// error-pattern: language item required, but not found: `eh_personality` -// ignore-emscripten compiled with panic=abort, personality not required - -#![no_std] - -extern crate core; -extern crate weak_lang_items; - -fn main() {} diff --git a/src/test/run-make-fulldeps/many-crates-but-no-match/Makefile b/src/test/run-make-fulldeps/many-crates-but-no-match/Makefile index 03a797d95f9..e7268311b13 100644 --- a/src/test/run-make-fulldeps/many-crates-but-no-match/Makefile +++ b/src/test/run-make-fulldeps/many-crates-but-no-match/Makefile @@ -1,9 +1,8 @@ -include ../tools.mk -# Modelled after compile-fail/changing-crates test, but this one puts +# Modelled after ui/changing-crates.rs test, but this one puts # more than one (mismatching) candidate crate into the search path, -# which did not appear directly expressible in compile-fail/aux-build -# infrastructure. +# which did not appear directly expressible in UI testing infrastructure. # # Note that we move the built libraries into target direcrtories rather than # use the `--out-dir` option because the `../tools.mk` file already bakes a @@ -33,4 +32,4 @@ all: 'crate `crateA`:' \ 'crate `crateB`:' \ < $(LOG) - # the 'crate `crateA`' will match two entries. \ No newline at end of file + # the 'crate `crateA`' will match two entries. diff --git a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs index 12898aa5c74..71b38a9f8ca 100644 --- a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs +++ b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs @@ -5,7 +5,7 @@ // causing a type mismatch. // The test is nearly the same as the one in -// compile-fail/type-mismatch-same-crate-name.rs +// ui/type/type-mismatch-same-crate-name.rs // but deals with the case where one of the crates // is only introduced as an indirect dependency. // and the type is accessed via a re-export. diff --git a/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs index fabcd727482..cc97971a0dd 100644 --- a/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs +++ b/src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs @@ -1,8 +1,8 @@ // Reject mixing cyclic structure and Drop when using TypedArena. // -// (Compare against compile-fail/dropck_vec_cycle_checked.rs) +// (Compare against dropck-vec-cycle-checked.rs) // -// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs, +// (Also compare against ui-fulldeps/dropck-tarena-unsound-drop.rs, // which is a reduction of this code to more directly show the reason // for the error message we see here.) diff --git a/src/test/ui-fulldeps/dropck_tarena_sound_drop.rs b/src/test/ui-fulldeps/dropck_tarena_sound_drop.rs index c5b9efee8e7..187f9a24a90 100644 --- a/src/test/ui-fulldeps/dropck_tarena_sound_drop.rs +++ b/src/test/ui-fulldeps/dropck_tarena_sound_drop.rs @@ -5,7 +5,7 @@ // methods might access borrowed data, as long as the borrowed data // has lifetime that strictly outlives the arena itself. // -// Compare against compile-fail/dropck_tarena_unsound_drop.rs, which +// Compare against ui-fulldeps/dropck-tarena-unsound-drop.rs, which // shows a similar setup, but restricts `f` so that the struct `C<'a>` // is force-fed a lifetime equal to that of the borrowed arena. diff --git a/src/test/ui/array-slice-vec/copy-out-of-array-1.rs b/src/test/ui/array-slice-vec/copy-out-of-array-1.rs index e64985ae3f6..c6d311148d0 100644 --- a/src/test/ui/array-slice-vec/copy-out-of-array-1.rs +++ b/src/test/ui/array-slice-vec/copy-out-of-array-1.rs @@ -2,7 +2,7 @@ // Ensure that we can copy out of a fixed-size array. // -// (Compare with compile-fail/move-out-of-array-1.rs) +// (Compare with ui/moves/move-out-of-array-1.rs) #[derive(Copy, Clone)] struct C { _x: u8 } diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait.rs b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait.rs index 5f06a829600..3b8c8c019e5 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait.rs +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait.rs @@ -3,7 +3,7 @@ // the trait definition if there is no default method and for every impl, // `Self` does implement `Get`. // -// See also compile-fail tests associated-types-no-suitable-supertrait +// See also tests associated-types-no-suitable-supertrait // and associated-types-no-suitable-supertrait-2, which show how small // variants of the code below can fail. diff --git a/src/test/ui/associated-types/issue-23595-1.rs b/src/test/ui/associated-types/issue-23595-1.rs new file mode 100644 index 00000000000..483c205f42d --- /dev/null +++ b/src/test/ui/associated-types/issue-23595-1.rs @@ -0,0 +1,14 @@ +#![feature(associated_type_defaults)] + +use std::ops::Index; + +trait Hierarchy { + type Value; + type ChildKey; + type Children = dyn Index; + //~^ ERROR: the value of the associated types + + fn data(&self) -> Option<(Self::Value, Self::Children)>; +} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-23595-1.stderr b/src/test/ui/associated-types/issue-23595-1.stderr new file mode 100644 index 00000000000..bb455684ee3 --- /dev/null +++ b/src/test/ui/associated-types/issue-23595-1.stderr @@ -0,0 +1,16 @@ +error[E0191]: the value of the associated types `ChildKey` (from trait `Hierarchy`), `Children` (from trait `Hierarchy`), `Value` (from trait `Hierarchy`) must be specified + --> $DIR/issue-23595-1.rs:8:58 + | +LL | type Value; + | ----------- `Value` defined here +LL | type ChildKey; + | -------------- `ChildKey` defined here +LL | type Children = dyn Index; + | -----------------------------------------------------^^^^^^^^^-- + | | | + | | help: specify the associated types: `Hierarchy` + | `Children` defined here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0191`. diff --git a/src/test/ui/associated-types/issue-27675-unchecked-bounds.rs b/src/test/ui/associated-types/issue-27675-unchecked-bounds.rs new file mode 100644 index 00000000000..1cfc2304531 --- /dev/null +++ b/src/test/ui/associated-types/issue-27675-unchecked-bounds.rs @@ -0,0 +1,19 @@ +/// The compiler previously did not properly check the bound of `From` when it was used from type +/// of the dyn trait object (use in `copy_any` below). Since the associated type is under user +/// control in this usage, the compiler could be tricked to believe any type implemented any trait. +/// This would ICE, except for pure marker traits like `Copy`. It did not require providing an +/// instance of the dyn trait type, only name said type. +trait Setup { + type From: Copy; +} + +fn copy(from: &U::From) -> U::From { + *from +} + +pub fn copy_any(t: &T) -> T { + copy::>(t) + //~^ ERROR the trait bound `T: Copy` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr new file mode 100644 index 00000000000..02396bd00a5 --- /dev/null +++ b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `T: Copy` is not satisfied + --> $DIR/issue-27675-unchecked-bounds.rs:15:31 + | +LL | fn copy(from: &U::From) -> U::From { + | ----- required by this bound in `copy` +... +LL | copy::>(t) + | ^ the trait `Copy` is not implemented for `T` + | +help: consider restricting type parameter `T` + | +LL | pub fn copy_any(t: &T) -> T { + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs new file mode 100644 index 00000000000..36777693fab --- /dev/null +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs @@ -0,0 +1,5 @@ +fn main() { + let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; + //~^ ERROR E0133 + let _: unsafe fn() = || unsafe { ::std::pin::Pin::new_unchecked(&0_u8); }; // OK +} diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr new file mode 100644 index 00000000000..a1fb1c02e46 --- /dev/null +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31 + | +LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.rs b/src/test/ui/closures/coerce-unsafe-to-closure.rs new file mode 100644 index 00000000000..78bdd36f9cc --- /dev/null +++ b/src/test/ui/closures/coerce-unsafe-to-closure.rs @@ -0,0 +1,4 @@ +fn main() { + let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); + //~^ ERROR E0277 +} diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr new file mode 100644 index 00000000000..ab035d03b05 --- /dev/null +++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr @@ -0,0 +1,11 @@ +error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + --> $DIR/coerce-unsafe-to-closure.rs:2:44 + | +LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); + | ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + | + = help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/consts/const-fn-error.rs b/src/test/ui/consts/const-fn-error.rs new file mode 100644 index 00000000000..68a4d414ff3 --- /dev/null +++ b/src/test/ui/consts/const-fn-error.rs @@ -0,0 +1,21 @@ +#![feature(const_fn)] + +const X : usize = 2; + +const fn f(x: usize) -> usize { + let mut sum = 0; + for i in 0..x { + //~^ ERROR mutable references + //~| ERROR calls in constant functions + //~| ERROR calls in constant functions + //~| ERROR E0080 + //~| ERROR E0744 + sum += i; + } + sum +} + +#[allow(unused_variables)] +fn main() { + let a : [i32; f(X)]; +} diff --git a/src/test/ui/consts/const-fn-error.stderr b/src/test/ui/consts/const-fn-error.stderr new file mode 100644 index 00000000000..86b1eebcb2c --- /dev/null +++ b/src/test/ui/consts/const-fn-error.stderr @@ -0,0 +1,49 @@ +error[E0744]: `for` is not allowed in a `const fn` + --> $DIR/const-fn-error.rs:7:5 + | +LL | / for i in 0..x { +LL | | +LL | | +LL | | +... | +LL | | sum += i; +LL | | } + | |_____^ + +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants + --> $DIR/const-fn-error.rs:7:14 + | +LL | for i in 0..x { + | ^^^^ + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/const-fn-error.rs:7:14 + | +LL | for i in 0..x { + | ^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants + --> $DIR/const-fn-error.rs:7:14 + | +LL | for i in 0..x { + | ^^^^ + +error[E0080]: evaluation of constant value failed + --> $DIR/const-fn-error.rs:7:14 + | +LL | for i in 0..x { + | ^^^^ + | | + | calling non-const function ` as IntoIterator>::into_iter` + | inside `f` at $DIR/const-fn-error.rs:7:14 +... +LL | let a : [i32; f(X)]; + | ---- inside `main::{constant#0}` at $DIR/const-fn-error.rs:20:19 + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0015, E0080, E0658, E0744. +For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/consts/issue-44415.rs b/src/test/ui/consts/issue-44415.rs new file mode 100644 index 00000000000..71e764620d1 --- /dev/null +++ b/src/test/ui/consts/issue-44415.rs @@ -0,0 +1,11 @@ +#![feature(core_intrinsics)] + +use std::intrinsics; + +struct Foo { + bytes: [u8; unsafe { intrinsics::size_of::() }], + //~^ ERROR cycle detected when simplifying constant for the type system + x: usize, +} + +fn main() {} diff --git a/src/test/ui/consts/issue-44415.stderr b/src/test/ui/consts/issue-44415.stderr new file mode 100644 index 00000000000..38841e99a72 --- /dev/null +++ b/src/test/ui/consts/issue-44415.stderr @@ -0,0 +1,28 @@ +error[E0391]: cycle detected when simplifying constant for the type system `Foo::bytes::{constant#0}` + --> $DIR/issue-44415.rs:6:17 + | +LL | bytes: [u8; unsafe { intrinsics::size_of::() }], + | ^^^^^^ + | +note: ...which requires simplifying constant for the type system `Foo::bytes::{constant#0}`... + --> $DIR/issue-44415.rs:6:17 + | +LL | bytes: [u8; unsafe { intrinsics::size_of::() }], + | ^^^^^^ +note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`... + --> $DIR/issue-44415.rs:6:17 + | +LL | bytes: [u8; unsafe { intrinsics::size_of::() }], + | ^^^^^^ + = note: ...which requires computing layout of `Foo`... + = note: ...which requires normalizing `[u8; _]`... + = note: ...which again requires simplifying constant for the type system `Foo::bytes::{constant#0}`, completing the cycle +note: cycle used when checking that `Foo` is well-formed + --> $DIR/issue-44415.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/consts/issue-55878.rs b/src/test/ui/consts/issue-55878.rs new file mode 100644 index 00000000000..c1c54646db8 --- /dev/null +++ b/src/test/ui/consts/issue-55878.rs @@ -0,0 +1,8 @@ +// build-fail +// normalize-stderr-64bit "18446744073709551615" -> "SIZE" +// normalize-stderr-32bit "4294967295" -> "SIZE" + +// error-pattern: are too big for the current architecture +fn main() { + println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); +} diff --git a/src/test/ui/consts/issue-55878.stderr b/src/test/ui/consts/issue-55878.stderr new file mode 100644 index 00000000000..924910e9cb6 --- /dev/null +++ b/src/test/ui/consts/issue-55878.stderr @@ -0,0 +1,25 @@ +error[E0080]: values of the type `[u8; SIZE]` are too big for the current architecture + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + | +LL | intrinsics::size_of::() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | inside `std::mem::size_of::<[u8; SIZE]>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL + | inside `main` at $DIR/issue-55878.rs:7:26 + | + ::: $DIR/issue-55878.rs:7:26 + | +LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); + | ---------------------------------------------- + +error: erroneous constant used + --> $DIR/issue-55878.rs:7:26 + | +LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + | + = note: `#[deny(const_err)]` on by default + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/crate-loading/auxiliary/crateresolve1-1.rs b/src/test/ui/crate-loading/auxiliary/crateresolve1-1.rs new file mode 100644 index 00000000000..a00a19e46d5 --- /dev/null +++ b/src/test/ui/crate-loading/auxiliary/crateresolve1-1.rs @@ -0,0 +1,5 @@ +// compile-flags:-C extra-filename=-1 +#![crate_name = "crateresolve1"] +#![crate_type = "lib"] + +pub fn f() -> isize { 10 } diff --git a/src/test/ui/crate-loading/auxiliary/crateresolve1-2.rs b/src/test/ui/crate-loading/auxiliary/crateresolve1-2.rs new file mode 100644 index 00000000000..71cc0a12ea3 --- /dev/null +++ b/src/test/ui/crate-loading/auxiliary/crateresolve1-2.rs @@ -0,0 +1,5 @@ +// compile-flags:-C extra-filename=-2 +#![crate_name = "crateresolve1"] +#![crate_type = "lib"] + +pub fn f() -> isize { 20 } diff --git a/src/test/ui/crate-loading/auxiliary/crateresolve1-3.rs b/src/test/ui/crate-loading/auxiliary/crateresolve1-3.rs new file mode 100644 index 00000000000..921687d4c3b --- /dev/null +++ b/src/test/ui/crate-loading/auxiliary/crateresolve1-3.rs @@ -0,0 +1,5 @@ +// compile-flags:-C extra-filename=-3 +#![crate_name = "crateresolve1"] +#![crate_type = "lib"] + +pub fn f() -> isize { 30 } diff --git a/src/test/ui/crate-loading/crateresolve1.rs b/src/test/ui/crate-loading/crateresolve1.rs new file mode 100644 index 00000000000..49e47dacc3d --- /dev/null +++ b/src/test/ui/crate-loading/crateresolve1.rs @@ -0,0 +1,10 @@ +// dont-check-compiler-stderr +// aux-build:crateresolve1-1.rs +// aux-build:crateresolve1-2.rs +// aux-build:crateresolve1-3.rs +// error-pattern:multiple matching crates for `crateresolve1` + +extern crate crateresolve1; + +fn main() { +} diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.rs b/src/test/ui/dropck/dropck_trait_cycle_checked.rs index bea77dc9f5c..be6ec3e4ed1 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.rs +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.rs @@ -1,7 +1,7 @@ // Reject mixing cyclic structure and Drop when using trait // objects to hide the cross-references. // -// (Compare against compile-fail/dropck_vec_cycle_checked.rs) +// (Compare against ui/span/dropck_vec_cycle_checked.rs) use std::cell::Cell; use id::Id; diff --git a/src/test/ui/extern-flag/empty-extern-arg.rs b/src/test/ui/extern-flag/empty-extern-arg.rs new file mode 100644 index 00000000000..d3cb5aaaeba --- /dev/null +++ b/src/test/ui/extern-flag/empty-extern-arg.rs @@ -0,0 +1,4 @@ +// compile-flags: --extern std= +// error-pattern: extern location for std does not exist + +fn main() {} diff --git a/src/test/ui/extern-flag/empty-extern-arg.stderr b/src/test/ui/extern-flag/empty-extern-arg.stderr new file mode 100644 index 00000000000..199c4fb616b --- /dev/null +++ b/src/test/ui/extern-flag/empty-extern-arg.stderr @@ -0,0 +1,4 @@ +error: extern location for std does not exist: + +error: aborting due to previous error + diff --git a/src/test/ui/fsu-moves-and-copies.rs b/src/test/ui/fsu-moves-and-copies.rs index c41bcc73fa5..6a0b4ed17b9 100644 --- a/src/test/ui/fsu-moves-and-copies.rs +++ b/src/test/ui/fsu-moves-and-copies.rs @@ -36,7 +36,7 @@ impl Drop for DropMoveFoo { fn drop(&mut self) { } } fn test0() { // just copy implicitly copyable fields from `f`, no moves // (and thus it is okay that these are Drop; compare against - // compile-fail test: borrowck-struct-update-with-dtor.rs). + // test ui/borrowck/borrowck-struct-update-with-dtor.rs). // Case 1: Nocopyable let f = DropNoFoo::new(1, 2); diff --git a/src/test/ui/functions-closures/closure-expected-type/README.md b/src/test/ui/functions-closures/closure-expected-type/README.md index fd493e1ff37..11d2c9b7fb7 100644 --- a/src/test/ui/functions-closures/closure-expected-type/README.md +++ b/src/test/ui/functions-closures/closure-expected-type/README.md @@ -5,4 +5,4 @@ inputs. This investigation was kicked off by #38714, which revealed some pretty deep flaws in the ad-hoc way that we were doing things before. -See also `src/test/compile-fail/closure-expected-type`. +See also `src/test/ui/closure-expected-type`. diff --git a/src/test/ui/issues/issue-26996.rs b/src/test/ui/issues/issue-26996.rs index 04382be27d7..84037b72a27 100644 --- a/src/test/ui/issues/issue-26996.rs +++ b/src/test/ui/issues/issue-26996.rs @@ -1,6 +1,6 @@ // run-pass -// This test is bogus (i.e., should be compile-fail) during the period +// This test is bogus (i.e., should be check-fail) during the period // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it // diff --git a/src/test/ui/issues/issue-27021.rs b/src/test/ui/issues/issue-27021.rs index 30551375450..ef3b114a5fa 100644 --- a/src/test/ui/issues/issue-27021.rs +++ b/src/test/ui/issues/issue-27021.rs @@ -1,6 +1,6 @@ // run-pass -// This test is bogus (i.e., should be compile-fail) during the period +// This test is bogus (i.e., should be check-fail) during the period // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it // diff --git a/src/test/ui/issues/issue-28498-ugeh-with-lifetime-param.rs b/src/test/ui/issues/issue-28498-ugeh-with-lifetime-param.rs index aea9fde5309..43c0bfb26cd 100644 --- a/src/test/ui/issues/issue-28498-ugeh-with-lifetime-param.rs +++ b/src/test/ui/issues/issue-28498-ugeh-with-lifetime-param.rs @@ -3,7 +3,7 @@ // Demonstrate the use of the unguarded escape hatch with a lifetime param // to assert that destructor will not access any dead data. // -// Compare with compile-fail/issue28498-reject-lifetime-param.rs +// Compare with ui/span/issue28498-reject-lifetime-param.rs #![feature(dropck_eyepatch)] diff --git a/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs b/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs index 91ef5a7c98d..23fd86a093b 100644 --- a/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs +++ b/src/test/ui/issues/issue-28498-ugeh-with-passed-to-fn.rs @@ -3,7 +3,7 @@ // Demonstrate the use of the unguarded escape hatch with a type param in negative position // to assert that destructor will not access any dead data. // -// Compare with compile-fail/issue28498-reject-lifetime-param.rs +// Compare with ui/span/issue28498-reject-lifetime-param.rs // Demonstrate that a type param in negative position causes dropck to reject code // that might indirectly access previously dropped value. diff --git a/src/test/ui/issues/issue-28498-ugeh-with-trait-bound.rs b/src/test/ui/issues/issue-28498-ugeh-with-trait-bound.rs index 808f3b6e81e..61d11cf3834 100644 --- a/src/test/ui/issues/issue-28498-ugeh-with-trait-bound.rs +++ b/src/test/ui/issues/issue-28498-ugeh-with-trait-bound.rs @@ -3,7 +3,7 @@ // Demonstrate the use of the unguarded escape hatch with a trait bound // to assert that destructor will not access any dead data. // -// Compare with compile-fail/issue28498-reject-trait-bound.rs +// Compare with ui/span/issue28498-reject-trait-bound.rs #![feature(dropck_eyepatch)] diff --git a/src/test/ui/issues/issue-43733.rs b/src/test/ui/issues/issue-43733.rs deleted file mode 100644 index a602d7667c4..00000000000 --- a/src/test/ui/issues/issue-43733.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![feature(const_fn)] -#![feature(thread_local)] -#![feature(cfg_target_thread_local, thread_local_internals)] - -type Foo = std::cell::RefCell; - -#[cfg(target_thread_local)] -#[thread_local] -static __KEY: std::thread::__FastLocalKeyInner = - std::thread::__FastLocalKeyInner::new(); - -#[cfg(not(target_thread_local))] -static __KEY: std::thread::__OsLocalKeyInner = - std::thread::__OsLocalKeyInner::new(); - -fn __getit() -> std::option::Option<&'static Foo> -{ - __KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe -} - -static FOO: std::thread::LocalKey = - std::thread::LocalKey::new(__getit); -//~^ ERROR call to unsafe function is unsafe - -fn main() { - FOO.with(|foo| println!("{}", foo.borrow())); - std::thread::spawn(|| { - FOO.with(|foo| *foo.borrow_mut() += "foo"); - }).join().unwrap(); - FOO.with(|foo| println!("{}", foo.borrow())); -} diff --git a/src/test/ui/issues/issue-43733.stderr b/src/test/ui/issues/issue-43733.stderr deleted file mode 100644 index ee6a3b065d6..00000000000 --- a/src/test/ui/issues/issue-43733.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:18:5 - | -LL | __KEY.get(Default::default) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:22:5 - | -LL | std::thread::LocalKey::new(__getit); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-49298.rs b/src/test/ui/issues/issue-49298.rs index 697a160b4ec..e3ffa8e7c6e 100644 --- a/src/test/ui/issues/issue-49298.rs +++ b/src/test/ui/issues/issue-49298.rs @@ -2,7 +2,7 @@ #![feature(test)] #![allow(unused_mut)] // under NLL we get warning about `x` below: rust-lang/rust#54499 -// This test is bogus (i.e., should be compile-fail) during the period +// This test is bogus (i.e., should be check-fail) during the period // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it // diff --git a/src/test/ui/linkage-attr/invalid-link-args.rs b/src/test/ui/linkage-attr/invalid-link-args.rs new file mode 100644 index 00000000000..5eb1c637f09 --- /dev/null +++ b/src/test/ui/linkage-attr/invalid-link-args.rs @@ -0,0 +1,14 @@ +// build-fail +// dont-check-compiler-stderr +// ignore-msvc due to linker-flavor=ld +// error-pattern:aFdEfSeVEEE +// compile-flags: -C linker-flavor=ld + +/* Make sure invalid link_args are printed to stderr. */ + +#![feature(link_args)] + +#[link_args = "aFdEfSeVEEE"] +extern {} + +fn main() { } diff --git a/src/test/ui/linkage-attr/issue-10755.rs b/src/test/ui/linkage-attr/issue-10755.rs new file mode 100644 index 00000000000..5ce69bceed3 --- /dev/null +++ b/src/test/ui/linkage-attr/issue-10755.rs @@ -0,0 +1,7 @@ +// build-fail +// dont-check-compiler-stderr +// compile-flags: -C linker=llllll -C linker-flavor=ld +// error-pattern: linker `llllll` not found + +fn main() { +} diff --git a/src/test/ui/lint/must_use-in-stdlib-traits.rs b/src/test/ui/lint/must_use-in-stdlib-traits.rs new file mode 100644 index 00000000000..70dddf61fb7 --- /dev/null +++ b/src/test/ui/lint/must_use-in-stdlib-traits.rs @@ -0,0 +1,47 @@ +#![deny(unused_must_use)] +#![feature(arbitrary_self_types)] + +use std::iter::Iterator; +use std::future::Future; + +use std::task::{Context, Poll}; +use std::pin::Pin; +use std::unimplemented; + +struct MyFuture; + +impl Future for MyFuture { + type Output = u32; + + fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { + Poll::Pending + } +} + +fn iterator() -> impl Iterator { + std::iter::empty::() +} + +fn future() -> impl Future { + MyFuture +} + +fn square_fn_once() -> impl FnOnce(u32) -> u32 { + |x| x * x +} + +fn square_fn_mut() -> impl FnMut(u32) -> u32 { + |x| x * x +} + +fn square_fn() -> impl Fn(u32) -> u32 { + |x| x * x +} + +fn main() { + iterator(); //~ ERROR unused implementer of `Iterator` that must be used + future(); //~ ERROR unused implementer of `Future` that must be used + square_fn_once(); //~ ERROR unused implementer of `FnOnce` that must be used + square_fn_mut(); //~ ERROR unused implementer of `FnMut` that must be used + square_fn(); //~ ERROR unused implementer of `Fn` that must be used +} diff --git a/src/test/ui/lint/must_use-in-stdlib-traits.stderr b/src/test/ui/lint/must_use-in-stdlib-traits.stderr new file mode 100644 index 00000000000..76978d29dc8 --- /dev/null +++ b/src/test/ui/lint/must_use-in-stdlib-traits.stderr @@ -0,0 +1,47 @@ +error: unused implementer of `Iterator` that must be used + --> $DIR/must_use-in-stdlib-traits.rs:42:4 + | +LL | iterator(); + | ^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/must_use-in-stdlib-traits.rs:1:9 + | +LL | #![deny(unused_must_use)] + | ^^^^^^^^^^^^^^^ + = note: iterators are lazy and do nothing unless consumed + +error: unused implementer of `Future` that must be used + --> $DIR/must_use-in-stdlib-traits.rs:43:4 + | +LL | future(); + | ^^^^^^^^^ + | + = note: futures do nothing unless you `.await` or poll them + +error: unused implementer of `FnOnce` that must be used + --> $DIR/must_use-in-stdlib-traits.rs:44:4 + | +LL | square_fn_once(); + | ^^^^^^^^^^^^^^^^^ + | + = note: closures are lazy and do nothing unless called + +error: unused implementer of `FnMut` that must be used + --> $DIR/must_use-in-stdlib-traits.rs:45:4 + | +LL | square_fn_mut(); + | ^^^^^^^^^^^^^^^^ + | + = note: closures are lazy and do nothing unless called + +error: unused implementer of `Fn` that must be used + --> $DIR/must_use-in-stdlib-traits.rs:46:4 + | +LL | square_fn(); + | ^^^^^^^^^^^^ + | + = note: closures are lazy and do nothing unless called + +error: aborting due to 5 previous errors + diff --git a/src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs b/src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs new file mode 100644 index 00000000000..387822d00f6 --- /dev/null +++ b/src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs @@ -0,0 +1,12 @@ +// build-fail +// dont-check-compiler-stderr +// compile-flags: -C codegen-units=2 +// ignore-emscripten + +#![feature(llvm_asm)] + +fn main() { + unsafe { + llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction + } +} diff --git a/src/test/ui/llvm-asm/asm-src-loc.rs b/src/test/ui/llvm-asm/asm-src-loc.rs new file mode 100644 index 00000000000..063066df11c --- /dev/null +++ b/src/test/ui/llvm-asm/asm-src-loc.rs @@ -0,0 +1,11 @@ +// build-fail +// dont-check-compiler-stderr +// ignore-emscripten + +#![feature(llvm_asm)] + +fn main() { + unsafe { + llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction + } +} diff --git a/src/test/ui/macros/macro-comma-behavior-rpass.rs b/src/test/ui/macros/macro-comma-behavior-rpass.rs index e5e656de6fa..c46274d59b6 100644 --- a/src/test/ui/macros/macro-comma-behavior-rpass.rs +++ b/src/test/ui/macros/macro-comma-behavior-rpass.rs @@ -8,7 +8,7 @@ // to it being e.g., a place where the addition of an argument // causes it to go down a code path with subtly different behavior). // -// There is a companion test in compile-fail. +// There is a companion failing test. // compile-flags: --test -C debug_assertions=yes // revisions: std core @@ -68,26 +68,26 @@ fn to_format_or_not_to_format() { assert!(true, "{}",); - // assert_eq!(1, 1, "{}",); // see compile-fail - // assert_ne!(1, 2, "{}",); // see compile-fail + // assert_eq!(1, 1, "{}",); // see check-fail + // assert_ne!(1, 2, "{}",); // see check-fail debug_assert!(true, "{}",); - // debug_assert_eq!(1, 1, "{}",); // see compile-fail - // debug_assert_ne!(1, 2, "{}",); // see compile-fail - // eprint!("{}",); // see compile-fail - // eprintln!("{}",); // see compile-fail - // format!("{}",); // see compile-fail - // format_args!("{}",); // see compile-fail + // debug_assert_eq!(1, 1, "{}",); // see check-fail + // debug_assert_ne!(1, 2, "{}",); // see check-fail + // eprint!("{}",); // see check-fail + // eprintln!("{}",); // see check-fail + // format!("{}",); // see check-fail + // format_args!("{}",); // see check-fail if falsum() { panic!("{}",); } - // print!("{}",); // see compile-fail - // println!("{}",); // see compile-fail - // unimplemented!("{}",); // see compile-fail + // print!("{}",); // see check-fail + // println!("{}",); // see check-fail + // unimplemented!("{}",); // see check-fail if falsum() { unreachable!("{}",); } - // write!(&mut stdout, "{}",); // see compile-fail - // writeln!(&mut stdout, "{}",); // see compile-fail + // write!(&mut stdout, "{}",); // see check-fail + // writeln!(&mut stdout, "{}",); // see check-fail } diff --git a/src/test/ui/macros/macro-comma-behavior.core.stderr b/src/test/ui/macros/macro-comma-behavior.core.stderr index dd0cac659fd..ac15e9fa8ea 100644 --- a/src/test/ui/macros/macro-comma-behavior.core.stderr +++ b/src/test/ui/macros/macro-comma-behavior.core.stderr @@ -23,22 +23,28 @@ LL | debug_assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:54:19 + --> $DIR/macro-comma-behavior.rs:52:19 | LL | format_args!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:72:21 + --> $DIR/macro-comma-behavior.rs:68:21 | LL | unimplemented!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:81:24 + --> $DIR/macro-comma-behavior.rs:77:24 | LL | write!(f, "{}",)?; | ^^ -error: aborting due to 7 previous errors +error: 1 positional argument in format string, but no arguments were given + --> $DIR/macro-comma-behavior.rs:81:26 + | +LL | writeln!(f, "{}",)?; + | ^^ + +error: aborting due to 8 previous errors diff --git a/src/test/ui/macros/macro-comma-behavior.rs b/src/test/ui/macros/macro-comma-behavior.rs index 0bfe0683078..27d50ff3d57 100644 --- a/src/test/ui/macros/macro-comma-behavior.rs +++ b/src/test/ui/macros/macro-comma-behavior.rs @@ -40,10 +40,8 @@ fn to_format_or_not_to_format() { } #[cfg(std)] { - // FIXME: compile-fail says "expected error not found" even though - // rustc does emit an error - // eprintln!("{}",); - // [std]~^ ERROR no arguments + eprintln!("{}",); + //[std]~^ ERROR no arguments } #[cfg(std)] { @@ -63,10 +61,8 @@ fn to_format_or_not_to_format() { } #[cfg(std)] { - // FIXME: compile-fail says "expected error not found" even though - // rustc does emit an error - // println!("{}",); - // [std]~^ ERROR no arguments + println!("{}",); + //[std]~^ ERROR no arguments } unimplemented!("{}",); @@ -82,11 +78,9 @@ fn to_format_or_not_to_format() { //[core]~^ ERROR no arguments //[std]~^^ ERROR no arguments - // FIXME: compile-fail says "expected error not found" even though - // rustc does emit an error - // writeln!(f, "{}",)?; - // [core]~^ ERROR no arguments - // [std]~^^ ERROR no arguments + writeln!(f, "{}",)?; + //[core]~^ ERROR no arguments + //[std]~^^ ERROR no arguments Ok(()) } } diff --git a/src/test/ui/macros/macro-comma-behavior.std.stderr b/src/test/ui/macros/macro-comma-behavior.std.stderr index 4372d89fbf5..7fd060e2224 100644 --- a/src/test/ui/macros/macro-comma-behavior.std.stderr +++ b/src/test/ui/macros/macro-comma-behavior.std.stderr @@ -29,34 +29,52 @@ LL | eprint!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:50:18 + --> $DIR/macro-comma-behavior.rs:43:20 + | +LL | eprintln!("{}",); + | ^^ + +error: 1 positional argument in format string, but no arguments were given + --> $DIR/macro-comma-behavior.rs:48:18 | LL | format!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:54:19 + --> $DIR/macro-comma-behavior.rs:52:19 | LL | format_args!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:61:17 + --> $DIR/macro-comma-behavior.rs:59:17 | LL | print!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:72:21 + --> $DIR/macro-comma-behavior.rs:64:19 + | +LL | println!("{}",); + | ^^ + +error: 1 positional argument in format string, but no arguments were given + --> $DIR/macro-comma-behavior.rs:68:21 | LL | unimplemented!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:81:24 + --> $DIR/macro-comma-behavior.rs:77:24 | LL | write!(f, "{}",)?; | ^^ -error: aborting due to 10 previous errors +error: 1 positional argument in format string, but no arguments were given + --> $DIR/macro-comma-behavior.rs:81:26 + | +LL | writeln!(f, "{}",)?; + | ^^ + +error: aborting due to 13 previous errors diff --git a/src/test/ui/macros/macro-comma-support-rpass.rs b/src/test/ui/macros/macro-comma-support-rpass.rs index 50c0ef3451d..f6c4f896d67 100644 --- a/src/test/ui/macros/macro-comma-support-rpass.rs +++ b/src/test/ui/macros/macro-comma-support-rpass.rs @@ -68,7 +68,7 @@ fn column() { let _ = column!(); } -// compile_error! is in a companion to this test in compile-fail +// compile_error! is in a check-fail companion to this test #[test] fn concat() { diff --git a/src/test/ui/macros/not-utf8.bin b/src/test/ui/macros/not-utf8.bin new file mode 100644 index 00000000000..4148e5b88fe Binary files /dev/null and b/src/test/ui/macros/not-utf8.bin differ diff --git a/src/test/ui/macros/not-utf8.rs b/src/test/ui/macros/not-utf8.rs new file mode 100644 index 00000000000..1cb1fdcb8c9 --- /dev/null +++ b/src/test/ui/macros/not-utf8.rs @@ -0,0 +1,5 @@ +// error-pattern: did not contain valid UTF-8 + +fn foo() { + include!("not-utf8.bin") +} diff --git a/src/test/ui/macros/not-utf8.stderr b/src/test/ui/macros/not-utf8.stderr new file mode 100644 index 00000000000..f47be14fae3 --- /dev/null +++ b/src/test/ui/macros/not-utf8.stderr @@ -0,0 +1,10 @@ +error: couldn't read $DIR/not-utf8.bin: stream did not contain valid UTF-8 + --> $DIR/not-utf8.rs:4:5 + | +LL | include!("not-utf8.bin") + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr b/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr new file mode 100644 index 00000000000..583b2c4cfe0 --- /dev/null +++ b/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/meta-expected-error-wrong-rev.rs:13:18 + | +LL | let x: u32 = 22_usize; + | --- ^^^^^^^^ expected `u32`, found `usize` + | | + | expected due to this + | +help: change the type of the numeric literal from `usize` to `u32` + | +LL | let x: u32 = 22_u32; + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/meta/meta-expected-error-wrong-rev.rs b/src/test/ui/meta/meta-expected-error-wrong-rev.rs new file mode 100644 index 00000000000..7e49434142b --- /dev/null +++ b/src/test/ui/meta/meta-expected-error-wrong-rev.rs @@ -0,0 +1,16 @@ +// ignore-compare-mode-nll + +// revisions: a +// should-fail + +// This is a "meta-test" of the compilertest framework itself. In +// particular, it includes the right error message, but the message +// targets the wrong revision, so we expect the execution to fail. +// See also `meta-expected-error-correct-rev.rs`. + +#[cfg(a)] +fn foo() { + let x: u32 = 22_usize; //[b]~ ERROR mismatched types +} + +fn main() { } diff --git a/src/test/ui/never_type/issue-52443.rs b/src/test/ui/never_type/issue-52443.rs new file mode 100644 index 00000000000..4519833b864 --- /dev/null +++ b/src/test/ui/never_type/issue-52443.rs @@ -0,0 +1,14 @@ +fn main() { + [(); & { loop { continue } } ]; //~ ERROR mismatched types + + [(); loop { break }]; //~ ERROR mismatched types + + [(); {while true {break}; 0}]; + //~^ WARN denote infinite loops with + + [(); { for _ in 0usize.. {}; 0}]; + //~^ ERROR `for` is not allowed in a `const` + //~| ERROR calls in constants are limited to constant functions + //~| ERROR mutable references are not allowed in constants + //~| ERROR calls in constants are limited to constant functions +} diff --git a/src/test/ui/never_type/issue-52443.stderr b/src/test/ui/never_type/issue-52443.stderr new file mode 100644 index 00000000000..051896cb89c --- /dev/null +++ b/src/test/ui/never_type/issue-52443.stderr @@ -0,0 +1,57 @@ +warning: denote infinite loops with `loop { ... }` + --> $DIR/issue-52443.rs:6:11 + | +LL | [(); {while true {break}; 0}]; + | ^^^^^^^^^^ help: use `loop` + | + = note: `#[warn(while_true)]` on by default + +error[E0744]: `for` is not allowed in a `const` + --> $DIR/issue-52443.rs:9:12 + | +LL | [(); { for _ in 0usize.. {}; 0}]; + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/issue-52443.rs:2:10 + | +LL | [(); & { loop { continue } } ]; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `usize`, found reference + | help: consider removing the borrow: `{ loop { continue } }` + | + = note: expected type `usize` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/issue-52443.rs:4:17 + | +LL | [(); loop { break }]; + | ^^^^^ + | | + | expected `usize`, found `()` + | help: give it a value of the expected type: `break 42` + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-52443.rs:9:21 + | +LL | [(); { for _ in 0usize.. {}; 0}]; + | ^^^^^^^^ + +error[E0764]: mutable references are not allowed in constants + --> $DIR/issue-52443.rs:9:21 + | +LL | [(); { for _ in 0usize.. {}; 0}]; + | ^^^^^^^^ `&mut` is only allowed in `const fn` + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-52443.rs:9:21 + | +LL | [(); { for _ in 0usize.. {}; 0}]; + | ^^^^^^^^ + +error: aborting due to 6 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0015, E0308, E0744, E0764. +For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/object-lifetime-default-from-rptr-box.rs b/src/test/ui/object-lifetime-default-from-rptr-box.rs index 8ac45b3db71..b61083078cc 100644 --- a/src/test/ui/object-lifetime-default-from-rptr-box.rs +++ b/src/test/ui/object-lifetime-default-from-rptr-box.rs @@ -23,7 +23,7 @@ fn b<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { ss.u = t; } -// see also compile-fail/object-lifetime-default-from-rptr-box-error.rs +// see also ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs fn d<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { ss.u = t; diff --git a/src/test/ui/panic-handler/auxiliary/weak-lang-items.rs b/src/test/ui/panic-handler/auxiliary/weak-lang-items.rs new file mode 100644 index 00000000000..7a698cf76ae --- /dev/null +++ b/src/test/ui/panic-handler/auxiliary/weak-lang-items.rs @@ -0,0 +1,22 @@ +// no-prefer-dynamic + +// This aux-file will require the eh_personality function to be codegen'd, but +// it hasn't been defined just yet. Make sure we don't explode. + +#![no_std] +#![crate_type = "rlib"] + +struct A; + +impl core::ops::Drop for A { + fn drop(&mut self) {} +} + +pub fn foo() { + let _a = A; + panic!("wut"); +} + +mod std { + pub use core::{option, fmt}; +} diff --git a/src/test/ui/panic-handler/panic-handler-missing.rs b/src/test/ui/panic-handler/panic-handler-missing.rs new file mode 100644 index 00000000000..6bb062ba657 --- /dev/null +++ b/src/test/ui/panic-handler/panic-handler-missing.rs @@ -0,0 +1,9 @@ +// dont-check-compiler-stderr +// error-pattern: `#[panic_handler]` function required, but not found + +#![feature(lang_items)] +#![no_main] +#![no_std] + +#[lang = "eh_personality"] +fn eh() {} diff --git a/src/test/ui/panic-handler/panic-handler-twice.rs b/src/test/ui/panic-handler/panic-handler-twice.rs new file mode 100644 index 00000000000..05bef66d849 --- /dev/null +++ b/src/test/ui/panic-handler/panic-handler-twice.rs @@ -0,0 +1,19 @@ +// dont-check-compiler-stderr +// aux-build:some-panic-impl.rs + +#![feature(lang_items)] +#![no_std] +#![no_main] + +extern crate some_panic_impl; + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(info: &PanicInfo) -> ! { + //~^ ERROR found duplicate lang item `panic_impl` + loop {} +} + +#[lang = "eh_personality"] +fn eh() {} diff --git a/src/test/ui/panic-handler/weak-lang-item.rs b/src/test/ui/panic-handler/weak-lang-item.rs new file mode 100644 index 00000000000..3fa3822831b --- /dev/null +++ b/src/test/ui/panic-handler/weak-lang-item.rs @@ -0,0 +1,11 @@ +// aux-build:weak-lang-items.rs +// error-pattern: `#[panic_handler]` function required, but not found +// error-pattern: language item required, but not found: `eh_personality` +// ignore-emscripten compiled with panic=abort, personality not required + +#![no_std] + +extern crate core; +extern crate weak_lang_items; + +fn main() {} diff --git a/src/test/ui/panic-handler/weak-lang-item.stderr b/src/test/ui/panic-handler/weak-lang-item.stderr new file mode 100644 index 00000000000..b7c040c7a85 --- /dev/null +++ b/src/test/ui/panic-handler/weak-lang-item.stderr @@ -0,0 +1,19 @@ +error[E0259]: the name `core` is defined multiple times + --> $DIR/weak-lang-item.rs:8:1 + | +LL | extern crate core; + | ^^^^^^^^^^^^^^^^^^ `core` reimported here + | + = note: `core` must be defined only once in the type namespace of this module +help: you can use `as` to change the binding name of the import + | +LL | extern crate core as other_core; + | + +error: `#[panic_handler]` function required, but not found + +error: language item required, but not found: `eh_personality` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0259`. diff --git a/src/test/ui/panic-runtime/auxiliary/depends.rs b/src/test/ui/panic-runtime/auxiliary/depends.rs new file mode 100644 index 00000000000..e9bc2f4893e --- /dev/null +++ b/src/test/ui/panic-runtime/auxiliary/depends.rs @@ -0,0 +1,8 @@ +// no-prefer-dynamic + +#![feature(panic_runtime)] +#![crate_type = "rlib"] +#![panic_runtime] +#![no_std] + +extern crate needs_panic_runtime; diff --git a/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs b/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs new file mode 100644 index 00000000000..3f030c169f6 --- /dev/null +++ b/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![feature(needs_panic_runtime)] +#![crate_type = "rlib"] +#![needs_panic_runtime] +#![no_std] diff --git a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs new file mode 100644 index 00000000000..d57f1643e98 --- /dev/null +++ b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs @@ -0,0 +1,8 @@ +// dont-check-compiler-stderr +// aux-build:needs-panic-runtime.rs +// aux-build:depends.rs +// error-pattern:cannot depend on a crate that needs a panic runtime + +extern crate depends; + +fn main() {} diff --git a/src/test/ui/panic-runtime/two-panic-runtimes.rs b/src/test/ui/panic-runtime/two-panic-runtimes.rs new file mode 100644 index 00000000000..c968b5ea1e1 --- /dev/null +++ b/src/test/ui/panic-runtime/two-panic-runtimes.rs @@ -0,0 +1,16 @@ +// build-fail +// dont-check-compiler-stderr +// error-pattern:cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2 +// ignore-tidy-linelength +// aux-build:panic-runtime-unwind.rs +// aux-build:panic-runtime-unwind2.rs +// aux-build:panic-runtime-lang-items.rs + +#![no_std] +#![no_main] + +extern crate panic_runtime_unwind; +extern crate panic_runtime_unwind2; +extern crate panic_runtime_lang_items; + +fn main() {} diff --git a/src/test/ui/panic-runtime/unwind-tables-panic-required.rs b/src/test/ui/panic-runtime/unwind-tables-panic-required.rs new file mode 100644 index 00000000000..6393a27046b --- /dev/null +++ b/src/test/ui/panic-runtime/unwind-tables-panic-required.rs @@ -0,0 +1,11 @@ +// Tests that the compiler errors if the user tries to turn off unwind tables +// when they are required. +// +// dont-check-compiler-stderr +// compile-flags: -C panic=unwind -C force-unwind-tables=no +// ignore-tidy-linelength +// +// error-pattern: panic=unwind requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`. + +pub fn main() { +} diff --git a/src/test/ui/panic-runtime/unwind-tables-target-required.rs b/src/test/ui/panic-runtime/unwind-tables-target-required.rs new file mode 100644 index 00000000000..14c17893764 --- /dev/null +++ b/src/test/ui/panic-runtime/unwind-tables-target-required.rs @@ -0,0 +1,11 @@ +// Tests that the compiler errors if the user tries to turn off unwind tables +// when they are required. +// +// only-x86_64-windows-msvc +// compile-flags: -C force-unwind-tables=no +// ignore-tidy-linelength +// +// error-pattern: target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`. + +pub fn main() { +} diff --git a/src/test/ui/panic-runtime/want-abort-got-unwind.rs b/src/test/ui/panic-runtime/want-abort-got-unwind.rs new file mode 100644 index 00000000000..e33c3bcc3f0 --- /dev/null +++ b/src/test/ui/panic-runtime/want-abort-got-unwind.rs @@ -0,0 +1,9 @@ +// build-fail +// dont-check-compiler-stderr +// error-pattern:is not compiled with this crate's panic strategy `abort` +// aux-build:panic-runtime-unwind.rs +// compile-flags:-C panic=abort + +extern crate panic_runtime_unwind; + +fn main() {} diff --git a/src/test/ui/panic-runtime/want-abort-got-unwind2.rs b/src/test/ui/panic-runtime/want-abort-got-unwind2.rs new file mode 100644 index 00000000000..438f1d85a28 --- /dev/null +++ b/src/test/ui/panic-runtime/want-abort-got-unwind2.rs @@ -0,0 +1,10 @@ +// build-fail +// dont-check-compiler-stderr +// error-pattern:is not compiled with this crate's panic strategy `abort` +// aux-build:panic-runtime-unwind.rs +// aux-build:wants-panic-runtime-unwind.rs +// compile-flags:-C panic=abort + +extern crate wants_panic_runtime_unwind; + +fn main() {} diff --git a/src/test/ui/privacy/issue-46209-private-enum-variant-reexport.rs b/src/test/ui/privacy/issue-46209-private-enum-variant-reexport.rs new file mode 100644 index 00000000000..d54c9931479 --- /dev/null +++ b/src/test/ui/privacy/issue-46209-private-enum-variant-reexport.rs @@ -0,0 +1,41 @@ +#![feature(crate_visibility_modifier)] + +mod rank { + pub use self::Professor::*; + //~^ ERROR enum is private and its variants cannot be re-exported + pub use self::Lieutenant::{JuniorGrade, Full}; + //~^ ERROR variant `JuniorGrade` is private and cannot be re-exported + //~| ERROR variant `Full` is private and cannot be re-exported + pub use self::PettyOfficer::*; + //~^ ERROR enum is private and its variants cannot be re-exported + pub use self::Crewman::*; + //~^ ERROR enum is private and its variants cannot be re-exported + + enum Professor { + Adjunct, + Assistant, + Associate, + Full + } + + enum Lieutenant { + JuniorGrade, + Full, + } + + pub(in rank) enum PettyOfficer { + SecondClass, + FirstClass, + Chief, + MasterChief + } + + crate enum Crewman { + Recruit, + Apprentice, + Full + } + +} + +fn main() {} diff --git a/src/test/ui/privacy/issue-46209-private-enum-variant-reexport.stderr b/src/test/ui/privacy/issue-46209-private-enum-variant-reexport.stderr new file mode 100644 index 00000000000..b876bab6c54 --- /dev/null +++ b/src/test/ui/privacy/issue-46209-private-enum-variant-reexport.stderr @@ -0,0 +1,44 @@ +error: variant `JuniorGrade` is private and cannot be re-exported + --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32 + | +LL | pub use self::Lieutenant::{JuniorGrade, Full}; + | ^^^^^^^^^^^ +... +LL | enum Lieutenant { + | --------------- help: consider making the enum public: `pub enum Lieutenant` + +error: variant `Full` is private and cannot be re-exported + --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45 + | +LL | pub use self::Lieutenant::{JuniorGrade, Full}; + | ^^^^ + +error: enum is private and its variants cannot be re-exported + --> $DIR/issue-46209-private-enum-variant-reexport.rs:4:13 + | +LL | pub use self::Professor::*; + | ^^^^^^^^^^^^^^^^^^ +... +LL | enum Professor { + | -------------- help: consider making the enum public: `pub enum Professor` + +error: enum is private and its variants cannot be re-exported + --> $DIR/issue-46209-private-enum-variant-reexport.rs:9:13 + | +LL | pub use self::PettyOfficer::*; + | ^^^^^^^^^^^^^^^^^^^^^ +... +LL | pub(in rank) enum PettyOfficer { + | ------------------------------ help: consider making the enum public: `pub enum PettyOfficer` + +error: enum is private and its variants cannot be re-exported + --> $DIR/issue-46209-private-enum-variant-reexport.rs:11:13 + | +LL | pub use self::Crewman::*; + | ^^^^^^^^^^^^^^^^ +... +LL | crate enum Crewman { + | ------------------ help: consider making the enum public: `pub enum Crewman` + +error: aborting due to 5 previous errors + diff --git a/src/test/ui/regions/regions-early-bound-trait-param.rs b/src/test/ui/regions/regions-early-bound-trait-param.rs index cc2bde78d85..276a64b8e9a 100644 --- a/src/test/ui/regions/regions-early-bound-trait-param.rs +++ b/src/test/ui/regions/regions-early-bound-trait-param.rs @@ -117,7 +117,7 @@ pub fn main() { let m : Box = make_val(); // assert_eq!(object_invoke1(&*m), (4,5)); // ~~~~~~~~~~~~~~~~~~~ - // this call yields a compilation error; see compile-fail/dropck-object-cycle.rs + // this call yields a compilation error; see ui/span/dropck-object-cycle.rs // for details. assert_eq!(object_invoke2(&*m), 5); diff --git a/src/test/ui/regions/regions-variance-contravariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-contravariant-use-contravariant.rs index f10d5a25f16..e6377867018 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-contravariant.rs @@ -4,7 +4,7 @@ // Test that a type which is contravariant with respect to its region // parameter compiles successfully when used in a contravariant way. // -// Note: see compile-fail/variance-regions-*.rs for the tests that check that the +// Note: see ui/variance/variance-regions-*.rs for the tests that check that the // variance inference works in the first place. // pretty-expanded FIXME #23616 diff --git a/src/test/ui/regions/regions-variance-covariant-use-covariant.rs b/src/test/ui/regions/regions-variance-covariant-use-covariant.rs index 9316aa15d32..c5c80ce54f1 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-covariant-use-covariant.rs @@ -3,7 +3,7 @@ // Test that a type which is covariant with respect to its region // parameter is successful when used in a covariant way. // -// Note: see compile-fail/variance-regions-*.rs for the tests that +// Note: see ui/variance/variance-regions-*.rs for the tests that // check that the variance inference works in the first place. // This is covariant with respect to 'a, meaning that diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs index ac31e4910d5..a14db5ff089 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.rs +++ b/src/test/ui/span/dropck_arr_cycle_checked.rs @@ -1,7 +1,7 @@ // Reject mixing cyclic structure and Drop when using fixed length // arrays. // -// (Compare against compile-fail/dropck_vec_cycle_checked.rs) +// (Compare against ui/span/dropck_vec_cycle_checked.rs) diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs index bacd99c6825..c5d21507d76 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.rs +++ b/src/test/ui/span/dropck_vec_cycle_checked.rs @@ -1,6 +1,6 @@ // Reject mixing cyclic structure and Drop when using Vec. // -// (Compare against compile-fail/dropck_arr_cycle_checked.rs) +// (Compare against ui/span/dropck_arr_cycle_checked.rs) use std::cell::Cell; use id::Id; diff --git a/src/test/ui/specialization/defaultimpl/projection.rs b/src/test/ui/specialization/defaultimpl/projection.rs index 4a914096932..f19c55b043b 100644 --- a/src/test/ui/specialization/defaultimpl/projection.rs +++ b/src/test/ui/specialization/defaultimpl/projection.rs @@ -4,7 +4,7 @@ #![feature(specialization)] //~ WARN the feature `specialization` is incomplete // Make sure we *can* project non-defaulted associated types -// cf compile-fail/specialization-default-projection.rs +// cf ui/specialization/specialization-default-projection.rs // First, do so without any use of specialization diff --git a/src/test/ui/specialization/issue-50452-fail.rs b/src/test/ui/specialization/issue-50452-fail.rs new file mode 100644 index 00000000000..fe21e9b6ede --- /dev/null +++ b/src/test/ui/specialization/issue-50452-fail.rs @@ -0,0 +1,21 @@ +#![feature(specialization)] +//~^ WARN the feature `specialization` is incomplete + +pub trait Foo { + fn foo(); +} + +impl Foo for i32 {} +impl Foo for i64 { + fn foo() {} + //~^ERROR `foo` specializes an item from a parent `impl` +} +impl Foo for T { + fn foo() {} +} + +fn main() { + i32::foo(); + i64::foo(); + u8::foo(); +} diff --git a/src/test/ui/specialization/issue-50452-fail.stderr b/src/test/ui/specialization/issue-50452-fail.stderr new file mode 100644 index 00000000000..8e7c5037eff --- /dev/null +++ b/src/test/ui/specialization/issue-50452-fail.stderr @@ -0,0 +1,26 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-50452-fail.rs:1:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + +error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` + --> $DIR/issue-50452-fail.rs:10:5 + | +LL | fn foo() {} + | ^^^^^^^^^^^ cannot specialize default item `foo` +... +LL | / impl Foo for T { +LL | | fn foo() {} +LL | | } + | |_- parent `impl` is here + | + = note: to specialize, `foo` in the parent `impl` must be marked `default` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0520`. diff --git a/src/test/ui/specialization/specialization-projection.rs b/src/test/ui/specialization/specialization-projection.rs index 700975e3b82..78afe7a9495 100644 --- a/src/test/ui/specialization/specialization-projection.rs +++ b/src/test/ui/specialization/specialization-projection.rs @@ -4,7 +4,7 @@ #![feature(specialization)] //~ WARN the feature `specialization` is incomplete // Make sure we *can* project non-defaulted associated types -// cf compile-fail/specialization-default-projection.rs +// cf ui/specialization/specialization-default-projection.rs // First, do so without any use of specialization diff --git a/src/test/ui/structs-enums/discrim-explicit-23030.rs b/src/test/ui/structs-enums/discrim-explicit-23030.rs index af7ab865e32..e17025e9e88 100644 --- a/src/test/ui/structs-enums/discrim-explicit-23030.rs +++ b/src/test/ui/structs-enums/discrim-explicit-23030.rs @@ -2,7 +2,7 @@ // Issue 23030: Workaround overflowing discriminant // with explicit assignments. -// See also compile-fail/overflow-discrim.rs, which shows what +// See also ui/discrim/discrim-overflow.rs, which shows what // happens if you leave the OhNo explicit cases out here. fn f_i8() { diff --git a/src/test/ui/structs-enums/object-lifetime-default-from-rptr-struct.rs b/src/test/ui/structs-enums/object-lifetime-default-from-rptr-struct.rs index 1fc52ead48e..d3e92e16246 100644 --- a/src/test/ui/structs-enums/object-lifetime-default-from-rptr-struct.rs +++ b/src/test/ui/structs-enums/object-lifetime-default-from-rptr-struct.rs @@ -27,7 +27,7 @@ fn b<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { ss.u = t; } -// see also compile-fail/object-lifetime-default-from-rptr-box-error.rs +// see also ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs fn d<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { ss.u = t; diff --git a/src/test/ui/svh/auxiliary/svh-uta-base.rs b/src/test/ui/svh/auxiliary/svh-uta-base.rs index c138f1a5ba8..221a096e083 100644 --- a/src/test/ui/svh/auxiliary/svh-uta-base.rs +++ b/src/test/ui/svh/auxiliary/svh-uta-base.rs @@ -1,4 +1,4 @@ -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a +//! "svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method //! resolution. diff --git a/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs b/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs index 76a472b5b26..823d29571aa 100644 --- a/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs +++ b/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs @@ -1,4 +1,4 @@ -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a +//! "svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method //! resolution. diff --git a/src/test/ui/svh/auxiliary/svh-utb.rs b/src/test/ui/svh/auxiliary/svh-utb.rs index 2f27e99a961..a03e29dcedc 100644 --- a/src/test/ui/svh/auxiliary/svh-utb.rs +++ b/src/test/ui/svh/auxiliary/svh-utb.rs @@ -1,4 +1,4 @@ -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a +//! "svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method //! resolution. diff --git a/src/test/ui/svh/svh-use-trait.rs b/src/test/ui/svh/svh-use-trait.rs index 93daca034c0..e5c427e096a 100644 --- a/src/test/ui/svh/svh-use-trait.rs +++ b/src/test/ui/svh/svh-use-trait.rs @@ -6,7 +6,7 @@ // aux-build:svh-uta-change-use-trait.rs // normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a +//! "svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method //! resolution. diff --git a/src/test/ui/threads-sendsync/issue-43733-2.rs b/src/test/ui/threads-sendsync/issue-43733-2.rs new file mode 100644 index 00000000000..21ea8e9a209 --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-43733-2.rs @@ -0,0 +1,30 @@ +// dont-check-compiler-stderr + +#![feature(cfg_target_thread_local, thread_local_internals)] + +// On platforms *without* `#[thread_local]`, use +// a custom non-`Sync` type to fake the same error. +#[cfg(not(target_thread_local))] +struct Key { + _data: std::cell::UnsafeCell>, + _flag: std::cell::Cell<()>, +} + +#[cfg(not(target_thread_local))] +impl Key { + const fn new() -> Self { + Key { + _data: std::cell::UnsafeCell::new(None), + _flag: std::cell::Cell::new(()), + } + } +} + +#[cfg(target_thread_local)] +use std::thread::__FastLocalKeyInner as Key; + +static __KEY: Key<()> = Key::new(); +//~^ ERROR `UnsafeCell>` cannot be shared between threads +//~| ERROR cannot be shared between threads safely [E0277] + +fn main() {} diff --git a/src/test/ui/threads-sendsync/issue-43733.rs b/src/test/ui/threads-sendsync/issue-43733.rs new file mode 100644 index 00000000000..a602d7667c4 --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-43733.rs @@ -0,0 +1,31 @@ +#![feature(const_fn)] +#![feature(thread_local)] +#![feature(cfg_target_thread_local, thread_local_internals)] + +type Foo = std::cell::RefCell; + +#[cfg(target_thread_local)] +#[thread_local] +static __KEY: std::thread::__FastLocalKeyInner = + std::thread::__FastLocalKeyInner::new(); + +#[cfg(not(target_thread_local))] +static __KEY: std::thread::__OsLocalKeyInner = + std::thread::__OsLocalKeyInner::new(); + +fn __getit() -> std::option::Option<&'static Foo> +{ + __KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe +} + +static FOO: std::thread::LocalKey = + std::thread::LocalKey::new(__getit); +//~^ ERROR call to unsafe function is unsafe + +fn main() { + FOO.with(|foo| println!("{}", foo.borrow())); + std::thread::spawn(|| { + FOO.with(|foo| *foo.borrow_mut() += "foo"); + }).join().unwrap(); + FOO.with(|foo| println!("{}", foo.borrow())); +} diff --git a/src/test/ui/threads-sendsync/issue-43733.stderr b/src/test/ui/threads-sendsync/issue-43733.stderr new file mode 100644 index 00000000000..ee6a3b065d6 --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-43733.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-43733.rs:18:5 + | +LL | __KEY.get(Default::default) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-43733.rs:22:5 + | +LL | std::thread::LocalKey::new(__getit); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/traits/traits-repeated-supertrait.rs b/src/test/ui/traits/traits-repeated-supertrait.rs index 391d19c4385..339f9c37eea 100644 --- a/src/test/ui/traits/traits-repeated-supertrait.rs +++ b/src/test/ui/traits/traits-repeated-supertrait.rs @@ -2,7 +2,7 @@ // Test a case of a trait which extends the same supertrait twice, but // with difference type parameters. Test that we can invoke the // various methods in various ways successfully. -// See also `compile-fail/trait-repeated-supertrait-ambig.rs`. +// See also `ui/traits/trait-repeated-supertrait-ambig.rs`. trait CompareTo { diff --git a/src/test/ui/unsafe-fn-called-from-unsafe-blk.rs b/src/test/ui/unsafe-fn-called-from-unsafe-blk.rs index 38271cc3c78..3713a7065f5 100644 --- a/src/test/ui/unsafe-fn-called-from-unsafe-blk.rs +++ b/src/test/ui/unsafe-fn-called-from-unsafe-blk.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // -// See also: compile-fail/unsafe-fn-called-from-safe.rs +// See also: ui/unsafe/unsafe-fn-called-from-safe.rs // pretty-expanded FIXME #23616 diff --git a/src/test/ui/unsafe-fn-called-from-unsafe-fn.rs b/src/test/ui/unsafe-fn-called-from-unsafe-fn.rs index 26acc913e87..5e953107686 100644 --- a/src/test/ui/unsafe-fn-called-from-unsafe-fn.rs +++ b/src/test/ui/unsafe-fn-called-from-unsafe-fn.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // -// See also: compile-fail/unsafe-fn-called-from-safe.rs +// See also: ui/unsafe/unsafe-fn-called-from-safe.rs // pretty-expanded FIXME #23616 diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 80fbb06b946..43dbaeb4655 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -10,8 +10,6 @@ use test::ColorConfig; #[derive(Clone, Copy, PartialEq, Debug)] pub enum Mode { - CompileFail, - RunFail, RunPassValgrind, Pretty, DebugInfo, @@ -42,8 +40,6 @@ impl FromStr for Mode { type Err = (); fn from_str(s: &str) -> Result { match s { - "compile-fail" => Ok(CompileFail), - "run-fail" => Ok(RunFail), "run-pass-valgrind" => Ok(RunPassValgrind), "pretty" => Ok(Pretty), "debuginfo" => Ok(DebugInfo), @@ -65,8 +61,6 @@ impl FromStr for Mode { impl fmt::Display for Mode { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let s = match *self { - CompileFail => "compile-fail", - RunFail => "run-fail", RunPassValgrind => "run-pass-valgrind", Pretty => "pretty", DebugInfo => "debuginfo", @@ -230,7 +224,7 @@ pub struct Config { /// The name of the stage being built (stage1, etc) pub stage_id: String, - /// The test mode, compile-fail, run-fail, ui + /// The test mode, e.g. ui or debuginfo. pub mode: Mode, /// The test suite (essentially which directory is running, but without the diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index a1be0a19f68..2eba91fd1f4 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -542,10 +542,7 @@ impl TestProps { } if self.failure_status == -1 { - self.failure_status = match config.mode { - Mode::RunFail => 101, - _ => 1, - }; + self.failure_status = 1; } if self.should_ice { self.failure_status = 101; diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index c63bbaf70d3..aefcfe222e5 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -71,7 +71,7 @@ pub fn parse_config(args: Vec) -> Config { "", "mode", "which sort of compile tests to run", - "compile-fail | run-fail | run-pass-valgrind | pretty | debug-info | codegen | rustdoc \ + "run-pass-valgrind | pretty | debug-info | codegen | rustdoc \ | rustdoc-json | codegen-units | incremental | run-make | ui | js-doc-test | mir-opt | assembly", ) .reqopt( diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 828c4e89f0b..9f31b3ae1b1 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -5,8 +5,8 @@ use crate::common::{output_base_dir, output_base_name, output_testname_unique}; use crate::common::{Assembly, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui}; use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc}; use crate::common::{CompareMode, FailMode, PassMode}; -use crate::common::{CompileFail, Pretty, RunFail, RunPassValgrind}; use crate::common::{Config, TestPaths}; +use crate::common::{Pretty, RunPassValgrind}; use crate::common::{UI_RUN_STDERR, UI_RUN_STDOUT}; use crate::errors::{self, Error, ErrorKind}; use crate::header::TestProps; @@ -330,13 +330,11 @@ impl<'test> TestCx<'test> { /// revisions, exactly once, with revision == None). fn run_revision(&self) { if self.props.should_ice { - if self.config.mode != CompileFail && self.config.mode != Incremental { + if self.config.mode != Incremental { self.fatal("cannot use should-ice in a test that is not cfail"); } } match self.config.mode { - CompileFail => self.run_cfail_test(), - RunFail => self.run_rfail_test(), RunPassValgrind => self.run_valgrind_test(), Pretty => self.run_pretty_test(), DebugInfo => self.run_debuginfo_test(), @@ -377,7 +375,6 @@ impl<'test> TestCx<'test> { fn should_compile_successfully(&self, pm: Option) -> bool { match self.config.mode { - CompileFail => false, JsDocTest => true, Ui => pm.is_some() || self.props.fail_mode > Some(FailMode::Build), Incremental => { @@ -1537,8 +1534,8 @@ impl<'test> TestCx<'test> { }; let allow_unused = match self.config.mode { - CompileFail | Ui => { - // compile-fail and ui tests tend to have tons of unused code as + Ui => { + // UI tests tend to have tons of unused code as // it's just testing various pieces of the compile, but we don't // want to actually assert warnings about all this code. Instead // let's just ignore unused code warnings by defaults and tests @@ -1940,7 +1937,7 @@ impl<'test> TestCx<'test> { } match self.config.mode { - CompileFail | Incremental => { + Incremental => { // If we are extracting and matching errors in the new // fashion, then you want JSON mode. Old-skool error // patterns still match the raw compiler output. @@ -1975,8 +1972,8 @@ impl<'test> TestCx<'test> { rustc.arg(dir_opt); } - RunFail | RunPassValgrind | Pretty | DebugInfo | Codegen | Rustdoc | RustdocJson - | RunMake | CodegenUnits | JsDocTest | Assembly => { + RunPassValgrind | Pretty | DebugInfo | Codegen | Rustdoc | RustdocJson | RunMake + | CodegenUnits | JsDocTest | Assembly => { // do not use JSON output } } diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index d78af2cd616..384a291a777 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -85,11 +85,7 @@ pub fn check( assert!(!lib_features.is_empty()); super::walk_many( - &[ - &src_path.join("test/ui"), - &src_path.join("test/ui-fulldeps"), - &src_path.join("test/compile-fail"), - ], + &[&src_path.join("test/ui"), &src_path.join("test/ui-fulldeps")], &mut |path| super::filter_dirs(path), &mut |entry, contents| { let file = entry.path(); -- cgit 1.4.1-3-g733a5 From 83322c067ec752a4e737fff3c88129ee4a7c9fe1 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Wed, 30 Dec 2020 00:00:00 +0000 Subject: remove unnecessary trailing semicolon from bootstrap --- src/bootstrap/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index def8f215436..a8b1082edeb 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -334,7 +334,7 @@ impl Merge for TomlConfig { *x = Some(new); } } - }; + } do_merge(&mut self.build, build); do_merge(&mut self.install, install); do_merge(&mut self.llvm, llvm); -- cgit 1.4.1-3-g733a5 From fe031180d0be11ce15ee82872829af4092356188 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 30 Dec 2020 08:04:59 -0500 Subject: Bump bootstrap compiler to 1.50 beta --- compiler/rustc_data_structures/src/lib.rs | 3 +- library/alloc/src/lib.rs | 3 +- library/core/src/intrinsics.rs | 1 - library/core/src/lib.rs | 5 +-- library/core/src/macros/mod.rs | 6 +-- library/core/src/sync/atomic.rs | 66 ++----------------------------- library/core/tests/mem.rs | 1 - library/proc_macro/src/lib.rs | 3 +- library/rtstartup/rsbegin.rs | 3 +- library/rtstartup/rsend.rs | 3 +- library/std/src/lib.rs | 3 +- library/std/src/macros.rs | 2 +- src/bootstrap/builder.rs | 5 +-- src/bootstrap/doc.rs | 5 +-- src/stage0.txt | 2 +- 15 files changed, 19 insertions(+), 92 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 01d3a759316..5880bbd3de4 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -15,8 +15,7 @@ #![feature(fn_traits)] #![feature(int_bits_const)] #![feature(min_specialization)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![feature(nll)] #![feature(allow_internal_unstable)] #![feature(hash_raw_entry)] diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 3ac34c9ae28..54b402faaeb 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -112,8 +112,7 @@ #![feature(never_type)] #![feature(nll)] #![feature(nonnull_slice_from_raw_parts)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![feature(or_patterns)] #![feature(pattern)] #![feature(ptr_internals)] diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 52921822693..74adb170a1d 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1736,7 +1736,6 @@ extern "rust-intrinsic" { /// Allocate at compile time. Should not be called at runtime. #[rustc_const_unstable(feature = "const_heap", issue = "79597")] - #[cfg(not(bootstrap))] pub fn const_allocate(size: usize, align: usize) -> *mut u8; } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 5b19bf6b80f..a3283b5b204 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -68,7 +68,7 @@ #![feature(arbitrary_self_types)] #![feature(asm)] #![feature(cfg_target_has_atomic)] -#![cfg_attr(not(bootstrap), feature(const_heap))] +#![feature(const_heap)] #![feature(const_alloc_layout)] #![feature(const_assert_type)] #![feature(const_discriminant)] @@ -122,8 +122,7 @@ #![feature(nll)] #![feature(exhaustive_patterns)] #![feature(no_core)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![feature(or_patterns)] #![feature(prelude_import)] #![feature(repr_simd, platform_intrinsics)] diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 0699c9eab18..1634aff7b4d 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -2,7 +2,7 @@ #[macro_export] #[allow_internal_unstable(core_panic, const_caller_location)] #[stable(feature = "core", since = "1.6.0")] -#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "core_panic_macro")] +#[rustc_diagnostic_item = "core_panic_macro"] macro_rules! panic { () => ( $crate::panic!("explicit panic") @@ -163,7 +163,7 @@ macro_rules! assert_ne { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "debug_assert_macro")] +#[rustc_diagnostic_item = "debug_assert_macro"] macro_rules! debug_assert { ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert!($($arg)*); }) } @@ -1217,7 +1217,7 @@ pub(crate) mod builtin { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_builtin_macro] #[macro_export] - #[cfg_attr(not(bootstrap), rustc_diagnostic_item = "assert_macro")] + #[rustc_diagnostic_item = "assert_macro"] #[allow_internal_unstable(core_panic)] macro_rules! assert { ($cond:expr $(,)?) => {{ /* compiler built-in */ }}; diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 36857979af8..e4b99e10354 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -991,16 +991,8 @@ impl AtomicPtr { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn load(&self, order: Ordering) -> *mut T { - #[cfg(not(bootstrap))] // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - atomic_load(self.p.get(), order) - } - #[cfg(bootstrap)] - // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - atomic_load(self.p.get() as *mut usize, order) as *mut T - } + unsafe { atomic_load(self.p.get(), order) } } /// Stores a value into the pointer. @@ -1027,16 +1019,10 @@ impl AtomicPtr { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn store(&self, ptr: *mut T, order: Ordering) { - #[cfg(not(bootstrap))] // SAFETY: data races are prevented by atomic intrinsics. unsafe { atomic_store(self.p.get(), ptr, order); } - #[cfg(bootstrap)] - // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - atomic_store(self.p.get() as *mut usize, ptr as usize, order); - } } /// Stores a value into the pointer, returning the previous value. @@ -1065,16 +1051,8 @@ impl AtomicPtr { #[stable(feature = "rust1", since = "1.0.0")] #[cfg(target_has_atomic = "ptr")] pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T { - #[cfg(bootstrap)] - // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - atomic_swap(self.p.get() as *mut usize, ptr as usize, order) as *mut T - } - #[cfg(not(bootstrap))] // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - atomic_swap(self.p.get(), ptr, order) - } + unsafe { atomic_swap(self.p.get(), ptr, order) } } /// Stores a value into the pointer if the current value is the same as the `current` value. @@ -1174,26 +1152,8 @@ impl AtomicPtr { success: Ordering, failure: Ordering, ) -> Result<*mut T, *mut T> { - #[cfg(bootstrap)] // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - let res = atomic_compare_exchange( - self.p.get() as *mut usize, - current as usize, - new as usize, - success, - failure, - ); - match res { - Ok(x) => Ok(x as *mut T), - Err(x) => Err(x as *mut T), - } - } - #[cfg(not(bootstrap))] - // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - atomic_compare_exchange(self.p.get(), current, new, success, failure) - } + unsafe { atomic_compare_exchange(self.p.get(), current, new, success, failure) } } /// Stores a value into the pointer if the current value is the same as the `current` value. @@ -1241,29 +1201,11 @@ impl AtomicPtr { success: Ordering, failure: Ordering, ) -> Result<*mut T, *mut T> { - #[cfg(bootstrap)] - // SAFETY: data races are prevented by atomic intrinsics. - unsafe { - let res = atomic_compare_exchange_weak( - self.p.get() as *mut usize, - current as usize, - new as usize, - success, - failure, - ); - match res { - Ok(x) => Ok(x as *mut T), - Err(x) => Err(x as *mut T), - } - } - #[cfg(not(bootstrap))] // SAFETY: This intrinsic is unsafe because it operates on a raw pointer // but we know for sure that the pointer is valid (we just got it from // an `UnsafeCell` that we have by reference) and the atomic operation // itself allows us to safely mutate the `UnsafeCell` contents. - unsafe { - atomic_compare_exchange_weak(self.p.get(), current, new, success, failure) - } + unsafe { atomic_compare_exchange_weak(self.p.get(), current, new, success, failure) } } /// Fetches the value, and applies a function to it that returns an optional diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs index 5d0fedd4d9c..c9bafa9c77e 100644 --- a/library/core/tests/mem.rs +++ b/library/core/tests/mem.rs @@ -134,7 +134,6 @@ fn test_discriminant_send_sync() { } #[test] -#[cfg(not(bootstrap))] fn assume_init_good() { const TRUE: bool = unsafe { MaybeUninit::::new(true).assume_init() }; diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index ca40293ed58..a89e7b53e43 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -28,8 +28,7 @@ #![feature(extern_types)] #![feature(in_band_lifetimes)] #![feature(negative_impls)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![feature(restricted_std)] #![feature(rustc_attrs)] #![feature(min_specialization)] diff --git a/library/rtstartup/rsbegin.rs b/library/rtstartup/rsbegin.rs index b64f13dba4c..c6a4548ec0c 100644 --- a/library/rtstartup/rsbegin.rs +++ b/library/rtstartup/rsbegin.rs @@ -14,8 +14,7 @@ #![feature(no_core)] #![feature(lang_items)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] diff --git a/library/rtstartup/rsend.rs b/library/rtstartup/rsend.rs index 18ee7c19ba0..d5aca80edf9 100644 --- a/library/rtstartup/rsend.rs +++ b/library/rtstartup/rsend.rs @@ -2,8 +2,7 @@ #![feature(no_core)] #![feature(lang_items)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![crate_type = "rlib"] #![no_core] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 4126c8b714f..2c6f03fe224 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -289,8 +289,7 @@ #![feature(nll)] #![feature(nonnull_slice_from_raw_parts)] #![feature(once_cell)] -#![cfg_attr(bootstrap, feature(optin_builtin_traits))] -#![cfg_attr(not(bootstrap), feature(auto_traits))] +#![feature(auto_traits)] #![feature(or_patterns)] #![feature(panic_info_message)] #![feature(panic_internals)] diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index de072e83dfc..5a70aa070e8 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -8,7 +8,7 @@ #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[allow_internal_unstable(libstd_sys_internals)] -#[cfg_attr(not(any(bootstrap, test)), rustc_diagnostic_item = "std_panic_macro")] +#[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_macro")] macro_rules! panic { () => ({ $crate::panic!("explicit panic") }); ($msg:expr $(,)?) => ({ $crate::rt::begin_panic($msg) }); diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index c271608a6b6..c2abb01fa8c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -736,10 +736,7 @@ impl<'a> Builder<'a> { if self.config.deny_warnings { cmd.arg("-Dwarnings"); } - // cfg(not(bootstrap)), can be removed on the next beta bump - if compiler.stage != 0 { - cmd.arg("-Znormalize-docs"); - } + cmd.arg("-Znormalize-docs"); // Remove make-related flags that can cause jobserver problems. cmd.env_remove("MAKEFLAGS"); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 2d60bb0a4bd..8c849846676 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -530,10 +530,7 @@ impl Step for Rustc { cargo.rustdocflag("--document-private-items"); cargo.rustdocflag("--enable-index-page"); cargo.rustdocflag("-Zunstable-options"); - // cfg(not(bootstrap)), can be removed on the next beta bump - if stage != 0 { - cargo.rustdocflag("-Znormalize-docs"); - } + cargo.rustdocflag("-Znormalize-docs"); compile::rustc_cargo(builder, &mut cargo, target); // Only include compiler crates, no dependencies of those, such as `libc`. diff --git a/src/stage0.txt b/src/stage0.txt index 6e05b66c3fe..e853b9b4e41 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # stable release's version number. `date` is the date where the release we're # bootstrapping off was released. -date: 2020-11-18 +date: 2020-12-30 rustc: beta # We use a nightly rustfmt to format the source because it solves some -- cgit 1.4.1-3-g733a5 From 5526d902508178293b98b4d8b7b39802107dc395 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Dec 2020 16:05:57 +0100 Subject: bootstrap: extract from any compression algorithm during distcheck --- src/bootstrap/test.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index b99692e8ba5..1b9523426e7 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1968,7 +1968,7 @@ impl Step for Distcheck { builder.ensure(dist::Src); let mut cmd = Command::new("tar"); - cmd.arg("-xzf") + cmd.arg("-xf") .arg(builder.ensure(dist::PlainSourceTarball)) .arg("--strip-components=1") .current_dir(&dir); @@ -1992,10 +1992,7 @@ impl Step for Distcheck { t!(fs::create_dir_all(&dir)); let mut cmd = Command::new("tar"); - cmd.arg("-xzf") - .arg(builder.ensure(dist::Src)) - .arg("--strip-components=1") - .current_dir(&dir); + cmd.arg("-xf").arg(builder.ensure(dist::Src)).arg("--strip-components=1").current_dir(&dir); builder.run(&mut cmd); let toml = dir.join("rust-src/lib/rustlib/src/rust/library/std/Cargo.toml"); -- cgit 1.4.1-3-g733a5 From aac429ffd312f7d1ee7a8c2a78c68a1839743b26 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Dec 2020 12:10:31 +0100 Subject: bootstrap: never delete the tarball temporary directory Files in the temporary directory are used by ./x.py install. --- src/bootstrap/dist.rs | 4 ++-- src/bootstrap/tarball.rs | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 0a79d09b27f..01c4ef4f5ae 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1316,8 +1316,8 @@ impl Step for Extended { tarballs.push(mingw_installer.unwrap()); } - let mut tarball = Tarball::new(builder, "rust", &target.triple); - let work = tarball.persist_work_dir(); + let tarball = Tarball::new(builder, "rust", &target.triple); + let work = tarball.work_dir(); tarball.combine(&tarballs); let tmp = tmpdir(builder).join("combined-tarball"); diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 137370fe6cb..91302dc3cfd 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -97,7 +97,6 @@ pub(crate) struct Tarball<'a> { include_target_in_component_name: bool, is_preview: bool, - delete_temp_dir: bool, } impl<'a> Tarball<'a> { @@ -136,7 +135,6 @@ impl<'a> Tarball<'a> { include_target_in_component_name: false, is_preview: false, - delete_temp_dir: true, } } @@ -198,8 +196,7 @@ impl<'a> Tarball<'a> { self.builder.cp_r(src.as_ref(), &dest); } - pub(crate) fn persist_work_dir(&mut self) -> PathBuf { - self.delete_temp_dir = false; + pub(crate) fn work_dir(&self) -> PathBuf { self.temp_dir.clone() } @@ -299,9 +296,6 @@ impl<'a> Tarball<'a> { cmd.arg("--compression-formats").arg(formats.join(",")); } self.builder.run(&mut cmd); - if self.delete_temp_dir { - t!(std::fs::remove_dir_all(&self.temp_dir)); - } // Use either the first compression format defined, or "gz" as the default. let ext = self -- cgit 1.4.1-3-g733a5 From 1fab57491dbdb739ec940be4169013dc0e9982e1 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Dec 2020 12:20:13 +0100 Subject: bootstrap: change the dist outputs to GeneratedTarball The struct will allow to store more context on the generated tarballs. --- src/bootstrap/dist.rs | 76 ++++++++++++++++++++++++------------------------ src/bootstrap/tarball.rs | 29 +++++++++++++----- src/bootstrap/test.rs | 7 +++-- 3 files changed, 64 insertions(+), 48 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 01c4ef4f5ae..a6957e410cd 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -19,7 +19,7 @@ use crate::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::cache::{Interned, INTERNER}; use crate::compile; use crate::config::TargetSelection; -use crate::tarball::{OverlayKind, Tarball}; +use crate::tarball::{GeneratedTarball, OverlayKind, Tarball}; use crate::tool::{self, Tool}; use crate::util::{exe, is_dylib, timeit}; use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS}; @@ -51,7 +51,7 @@ pub struct Docs { } impl Step for Docs { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -63,7 +63,7 @@ impl Step for Docs { } /// Builds the `rust-docs` installer component. - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; if !builder.config.docs { return None; @@ -86,7 +86,7 @@ pub struct RustcDocs { } impl Step for RustcDocs { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -98,7 +98,7 @@ impl Step for RustcDocs { } /// Builds the `rustc-docs` installer component. - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; if !builder.config.compiler_docs { return None; @@ -267,7 +267,7 @@ pub struct Mingw { } impl Step for Mingw { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -282,7 +282,7 @@ impl Step for Mingw { /// /// This contains all the bits and pieces to run the MinGW Windows targets /// without any extra installed software (e.g., we bundle gcc, libraries, etc). - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; if !host.contains("pc-windows-gnu") { return None; @@ -307,7 +307,7 @@ pub struct Rustc { } impl Step for Rustc { - type Output = PathBuf; + type Output = GeneratedTarball; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -321,7 +321,7 @@ impl Step for Rustc { } /// Creates the `rustc` installer component. - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let compiler = self.compiler; let host = self.compiler.host; @@ -555,7 +555,7 @@ pub struct Std { } impl Step for Std { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -573,7 +573,7 @@ impl Step for Std { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -601,7 +601,7 @@ pub struct RustcDev { } impl Step for RustcDev { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -620,7 +620,7 @@ impl Step for RustcDev { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; if skip_host_target_lib(builder, compiler) { @@ -660,7 +660,7 @@ pub struct Analysis { } impl Step for Analysis { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -683,7 +683,7 @@ impl Step for Analysis { } /// Creates a tarball of save-analysis metadata, if available. - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); @@ -796,7 +796,7 @@ pub struct Src; impl Step for Src { /// The output path of the src installer tarball - type Output = PathBuf; + type Output = GeneratedTarball; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -809,7 +809,7 @@ impl Step for Src { } /// Creates the `rust-src` installer component - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let tarball = Tarball::new_targetless(builder, "rust-src"); // A lot of tools expect the rust-src component to be entirely in this directory, so if you @@ -848,7 +848,7 @@ pub struct PlainSourceTarball; impl Step for PlainSourceTarball { /// Produces the location of the tarball generated - type Output = PathBuf; + type Output = GeneratedTarball; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -862,7 +862,7 @@ impl Step for PlainSourceTarball { } /// Creates the plain source tarball - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let tarball = Tarball::new(builder, "rustc", "src"); let plain_dst_src = tarball.image_dir(); @@ -941,7 +941,7 @@ pub struct Cargo { } impl Step for Cargo { - type Output = PathBuf; + type Output = GeneratedTarball; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -959,7 +959,7 @@ impl Step for Cargo { }); } - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let compiler = self.compiler; let target = self.target; @@ -995,7 +995,7 @@ pub struct Rls { } impl Step for Rls { - type Output = Option; + type Output = Option; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1013,7 +1013,7 @@ impl Step for Rls { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); @@ -1041,7 +1041,7 @@ pub struct RustAnalyzer { } impl Step for RustAnalyzer { - type Output = Option; + type Output = Option; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1059,7 +1059,7 @@ impl Step for RustAnalyzer { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); @@ -1090,7 +1090,7 @@ pub struct Clippy { } impl Step for Clippy { - type Output = PathBuf; + type Output = GeneratedTarball; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1108,7 +1108,7 @@ impl Step for Clippy { }); } - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); @@ -1140,7 +1140,7 @@ pub struct Miri { } impl Step for Miri { - type Output = Option; + type Output = Option; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1158,7 +1158,7 @@ impl Step for Miri { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); @@ -1193,7 +1193,7 @@ pub struct Rustfmt { } impl Step for Rustfmt { - type Output = Option; + type Output = Option; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1211,7 +1211,7 @@ impl Step for Rustfmt { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -1870,7 +1870,7 @@ pub struct LlvmTools { } impl Step for LlvmTools { - type Output = Option; + type Output = Option; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1881,7 +1881,7 @@ impl Step for LlvmTools { run.builder.ensure(LlvmTools { target: run.target }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let target = self.target; assert!(builder.config.extended); @@ -1924,7 +1924,7 @@ pub struct RustDev { } impl Step for RustDev { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -1936,7 +1936,7 @@ impl Step for RustDev { run.builder.ensure(RustDev { target: run.target }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Option { let target = self.target; /* run only if llvm-config isn't used */ @@ -1989,7 +1989,7 @@ pub struct BuildManifest { } impl Step for BuildManifest { - type Output = PathBuf; + type Output = GeneratedTarball; const DEFAULT: bool = false; const ONLY_HOSTS: bool = true; @@ -2001,7 +2001,7 @@ impl Step for BuildManifest { run.builder.ensure(BuildManifest { target: run.target }); } - fn run(self, builder: &Builder<'_>) -> PathBuf { + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let build_manifest = builder.tool_exe(Tool::BuildManifest); let tarball = Tarball::new(builder, "build-manifest", &self.target.triple); @@ -2021,7 +2021,7 @@ pub struct ReproducibleArtifacts { } impl Step for ReproducibleArtifacts { - type Output = Option; + type Output = Option; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 91302dc3cfd..06a113ed035 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -200,7 +200,7 @@ impl<'a> Tarball<'a> { self.temp_dir.clone() } - pub(crate) fn generate(self) -> PathBuf { + pub(crate) fn generate(self) -> GeneratedTarball { let mut component_name = self.component.clone(); if self.is_preview { component_name.push_str("-preview"); @@ -224,20 +224,20 @@ impl<'a> Tarball<'a> { }) } - pub(crate) fn combine(self, tarballs: &[PathBuf]) { - let mut input_tarballs = tarballs[0].as_os_str().to_os_string(); + pub(crate) fn combine(self, tarballs: &[GeneratedTarball]) -> GeneratedTarball { + let mut input_tarballs = tarballs[0].path.as_os_str().to_os_string(); for tarball in &tarballs[1..] { input_tarballs.push(","); - input_tarballs.push(tarball); + input_tarballs.push(&tarball.path); } self.run(|this, cmd| { cmd.arg("combine").arg("--input-tarballs").arg(input_tarballs); this.non_bare_args(cmd); - }); + }) } - pub(crate) fn bare(self) -> PathBuf { + pub(crate) fn bare(self) -> GeneratedTarball { // Bare tarballs should have the top level directory match the package // name, not "image". We rename the image directory just before passing // into rust-installer. @@ -273,7 +273,7 @@ impl<'a> Tarball<'a> { .arg(crate::dist::distdir(self.builder)); } - fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> PathBuf { + fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> GeneratedTarball { t!(std::fs::create_dir_all(&self.overlay_dir)); self.builder.create(&self.overlay_dir.join("version"), &self.overlay.version(self.builder)); if let Some(sha) = self.builder.rust_sha() { @@ -307,6 +307,19 @@ impl<'a> Tarball<'a> { .map(|s| s.as_str()) .unwrap_or("gz"); - crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)) + GeneratedTarball { + path: crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)), + } + } +} + +#[derive(Debug, Clone)] +pub struct GeneratedTarball { + path: PathBuf, +} + +impl GeneratedTarball { + pub(crate) fn tarball(&self) -> &Path { + &self.path } } diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 1f209f328a2..33e252a63c9 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1963,7 +1963,7 @@ impl Step for Distcheck { let mut cmd = Command::new("tar"); cmd.arg("-xf") - .arg(builder.ensure(dist::PlainSourceTarball)) + .arg(builder.ensure(dist::PlainSourceTarball).tarball()) .arg("--strip-components=1") .current_dir(&dir); builder.run(&mut cmd); @@ -1986,7 +1986,10 @@ impl Step for Distcheck { t!(fs::create_dir_all(&dir)); let mut cmd = Command::new("tar"); - cmd.arg("-xf").arg(builder.ensure(dist::Src)).arg("--strip-components=1").current_dir(&dir); + cmd.arg("-xf") + .arg(builder.ensure(dist::Src).tarball()) + .arg("--strip-components=1") + .current_dir(&dir); builder.run(&mut cmd); let toml = dir.join("rust-src/lib/rustlib/src/rust/library/std/Cargo.toml"); -- cgit 1.4.1-3-g733a5 From 8e0ab0fb5e35c96ba92c586eb9e0aa684fcd567d Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 30 Dec 2020 14:00:24 +0100 Subject: bootstrap: use the correct paths during ./x.py install --- src/bootstrap/dist.rs | 4 +- src/bootstrap/install.rs | 106 ++++++++++++++--------------------------------- src/bootstrap/tarball.rs | 16 +++++-- 3 files changed, 45 insertions(+), 81 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index a6957e410cd..daec1656b27 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1317,10 +1317,10 @@ impl Step for Extended { } let tarball = Tarball::new(builder, "rust", &target.triple); - let work = tarball.work_dir(); - tarball.combine(&tarballs); + let generated = tarball.combine(&tarballs); let tmp = tmpdir(builder).join("combined-tarball"); + let work = generated.work_dir(); let mut license = String::new(); license += &builder.read(&builder.src.join("COPYRIGHT")); diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 8f2b128b368..96164947943 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -10,60 +10,19 @@ use std::process::Command; use build_helper::t; -use crate::dist::{self, pkgname, sanitize_sh, tmpdir}; +use crate::dist::{self, sanitize_sh}; +use crate::tarball::GeneratedTarball; use crate::Compiler; use crate::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::config::{Config, TargetSelection}; -pub fn install_docs(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "docs", "rust-docs", stage, Some(host)); -} - -pub fn install_std(builder: &Builder<'_>, stage: u32, target: TargetSelection) { - install_sh(builder, "std", "rust-std", stage, Some(target)); -} - -pub fn install_cargo(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "cargo", "cargo", stage, Some(host)); -} - -pub fn install_rls(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "rls", "rls", stage, Some(host)); -} - -pub fn install_rust_analyzer(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "rust-analyzer", "rust-analyzer", stage, Some(host)); -} - -pub fn install_clippy(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "clippy", "clippy", stage, Some(host)); -} -pub fn install_miri(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "miri", "miri", stage, Some(host)); -} - -pub fn install_rustfmt(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "rustfmt", "rustfmt", stage, Some(host)); -} - -pub fn install_analysis(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "analysis", "rust-analysis", stage, Some(host)); -} - -pub fn install_src(builder: &Builder<'_>, stage: u32) { - install_sh(builder, "src", "rust-src", stage, None); -} -pub fn install_rustc(builder: &Builder<'_>, stage: u32, host: TargetSelection) { - install_sh(builder, "rustc", "rustc", stage, Some(host)); -} - fn install_sh( builder: &Builder<'_>, package: &str, - name: &str, stage: u32, host: Option, + tarball: &GeneratedTarball, ) { builder.info(&format!("Install {} stage{} ({:?})", package, stage, host)); @@ -108,15 +67,10 @@ fn install_sh( let empty_dir = builder.out.join("tmp/empty_dir"); t!(fs::create_dir_all(&empty_dir)); - let package_name = if let Some(host) = host { - format!("{}-{}", pkgname(builder, name), host.triple) - } else { - pkgname(builder, name) - }; let mut cmd = Command::new("sh"); cmd.current_dir(&empty_dir) - .arg(sanitize_sh(&tmpdir(builder).join(&package_name).join("install.sh"))) + .arg(sanitize_sh(&tarball.decompressed_output().join("install.sh"))) .arg(format!("--prefix={}", sanitize_sh(&prefix))) .arg(format!("--sysconfdir={}", sanitize_sh(&sysconfdir))) .arg(format!("--datadir={}", sanitize_sh(&datadir))) @@ -191,25 +145,25 @@ macro_rules! install { install!((self, builder, _config), Docs, "src/doc", _config.docs, only_hosts: false, { - builder.ensure(dist::Docs { host: self.target }); - install_docs(builder, self.compiler.stage, self.target); + let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs"); + install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball); }; Std, "library/std", true, only_hosts: false, { for target in &builder.targets { - builder.ensure(dist::Std { + let tarball = builder.ensure(dist::Std { compiler: self.compiler, target: *target - }); - install_std(builder, self.compiler.stage, *target); + }).expect("missing std"); + install_sh(builder, "std", self.compiler.stage, Some(*target), &tarball); } }; Cargo, "cargo", Self::should_build(_config), only_hosts: true, { - builder.ensure(dist::Cargo { compiler: self.compiler, target: self.target }); - install_cargo(builder, self.compiler.stage, self.target); + let tarball = builder.ensure(dist::Cargo { compiler: self.compiler, target: self.target }); + install_sh(builder, "cargo", self.compiler.stage, Some(self.target), &tarball); }; Rls, "rls", Self::should_build(_config), only_hosts: true, { - if builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }).is_some() { - install_rls(builder, self.compiler.stage, self.target); + if let Some(tarball) = builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }) { + install_sh(builder, "rls", self.compiler.stage, Some(self.target), &tarball); } else { builder.info( &format!("skipping Install RLS stage{} ({})", self.compiler.stage, self.target), @@ -217,16 +171,18 @@ install!((self, builder, _config), } }; RustAnalyzer, "rust-analyzer", Self::should_build(_config), only_hosts: true, { - builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target }); - install_rust_analyzer(builder, self.compiler.stage, self.target); + let tarball = builder + .ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target }) + .expect("missing rust-analyzer"); + install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball); }; Clippy, "clippy", Self::should_build(_config), only_hosts: true, { - builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target }); - install_clippy(builder, self.compiler.stage, self.target); + let tarball = builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target }); + install_sh(builder, "clippy", self.compiler.stage, Some(self.target), &tarball); }; Miri, "miri", Self::should_build(_config), only_hosts: true, { - if builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }).is_some() { - install_miri(builder, self.compiler.stage, self.target); + if let Some(tarball) = builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }) { + install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball); } else { builder.info( &format!("skipping Install miri stage{} ({})", self.compiler.stage, self.target), @@ -234,11 +190,11 @@ install!((self, builder, _config), } }; Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, { - if builder.ensure(dist::Rustfmt { + if let Some(tarball) = builder.ensure(dist::Rustfmt { compiler: self.compiler, target: self.target - }).is_some() { - install_rustfmt(builder, self.compiler.stage, self.target); + }) { + install_sh(builder, "rustfmt", self.compiler.stage, Some(self.target), &tarball); } else { builder.info( &format!("skipping Install Rustfmt stage{} ({})", self.compiler.stage, self.target), @@ -246,20 +202,20 @@ install!((self, builder, _config), } }; Analysis, "analysis", Self::should_build(_config), only_hosts: false, { - builder.ensure(dist::Analysis { + let tarball = builder.ensure(dist::Analysis { // Find the actual compiler (handling the full bootstrap option) which // produced the save-analysis data because that data isn't copied // through the sysroot uplifting. compiler: builder.compiler_for(builder.top_stage, builder.config.build, self.target), target: self.target - }); - install_analysis(builder, self.compiler.stage, self.target); + }).expect("missing analysis"); + install_sh(builder, "analysis", self.compiler.stage, Some(self.target), &tarball); }; Rustc, "src/librustc", true, only_hosts: true, { - builder.ensure(dist::Rustc { + let tarball = builder.ensure(dist::Rustc { compiler: builder.compiler(builder.top_stage, self.target), }); - install_rustc(builder, self.compiler.stage, self.target); + install_sh(builder, "rustc", self.compiler.stage, Some(self.target), &tarball); }; ); @@ -284,7 +240,7 @@ impl Step for Src { } fn run(self, builder: &Builder<'_>) { - builder.ensure(dist::Src); - install_src(builder, self.stage); + let tarball = builder.ensure(dist::Src); + install_sh(builder, "src", self.stage, None, &tarball); } } diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 06a113ed035..7fb03056f1b 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -196,10 +196,6 @@ impl<'a> Tarball<'a> { self.builder.cp_r(src.as_ref(), &dest); } - pub(crate) fn work_dir(&self) -> PathBuf { - self.temp_dir.clone() - } - pub(crate) fn generate(self) -> GeneratedTarball { let mut component_name = self.component.clone(); if self.is_preview { @@ -309,6 +305,8 @@ impl<'a> Tarball<'a> { GeneratedTarball { path: crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)), + decompressed_output: self.temp_dir.join(package_name), + work: self.temp_dir, } } } @@ -316,10 +314,20 @@ impl<'a> Tarball<'a> { #[derive(Debug, Clone)] pub struct GeneratedTarball { path: PathBuf, + decompressed_output: PathBuf, + work: PathBuf, } impl GeneratedTarball { pub(crate) fn tarball(&self) -> &Path { &self.path } + + pub(crate) fn decompressed_output(&self) -> &Path { + &self.decompressed_output + } + + pub(crate) fn work_dir(&self) -> &Path { + &self.work + } } -- cgit 1.4.1-3-g733a5