Skip to content

Commit

Permalink
Rollup merge of #121570 - Nilstrieb:!copy, r=clubby789
Browse files Browse the repository at this point in the history
Make most bootstrap step types !Copy

This makes all bootstrap types except for `Compiler` and `TargetSelection` `!Copy`. This makes it easier to modify them by adding !Copy types in the future, something that `@saethlin` has complained about before, and comes at no cost of code clarity, the impls were completely unused.

Making `Compiler` and `TargetSelection` `!Copy` (which would allow getting rid of interning) is highly nontrivial as they are used and copied **all over the place**. This should hopefully get most of the benefits.
  • Loading branch information
matthiaskrgr authored Feb 25, 2024
2 parents f548636 + 2401ae1 commit 3d5fd9d
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 99 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl Step for CodegenBackend {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RustAnalyzer {
pub target: TargetSelection,
}
Expand Down Expand Up @@ -441,7 +441,7 @@ impl Step for RustAnalyzer {

macro_rules! tool_check_step {
($name:ident, $path:literal, $($alias:literal, )* $source_type:path $(, $default:literal )?) => {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct $name {
pub target: TargetSelection,
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::utils::cache::Interned;
use crate::utils::helpers::t;
use crate::{Build, Compiler, Mode, Subcommand};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CleanAll {}

impl Step for CleanAll {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ fn apple_darwin_sign_file(file_path: &Path) {
assert!(status.success());
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct StartupObjects {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1491,7 +1491,7 @@ pub fn compiler_file(
PathBuf::from(out.trim())
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Sysroot {
pub compiler: Compiler,
/// See [`Std::force_recompile`].
Expand Down Expand Up @@ -1653,7 +1653,7 @@ impl Step for Sysroot {
}
}

#[derive(Debug, Copy, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
pub struct Assemble {
/// The compiler which we will produce in this step. Assemble itself will
/// take care of ensuring that the necessary prerequisites to do so exist,
Expand Down
38 changes: 19 additions & 19 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn should_build_extended_tool(builder: &Builder<'_>, tool: &str) -> bool {
builder.config.tools.as_ref().map_or(true, |tools| tools.contains(tool))
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Docs {
pub host: TargetSelection,
}
Expand Down Expand Up @@ -83,7 +83,7 @@ impl Step for Docs {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct JsonDocs {
pub host: TargetSelection,
}
Expand Down Expand Up @@ -121,7 +121,7 @@ impl Step for JsonDocs {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct RustcDocs {
pub host: TargetSelection,
}
Expand Down Expand Up @@ -308,7 +308,7 @@ fn make_win_dist(
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Mingw {
pub host: TargetSelection,
}
Expand Down Expand Up @@ -348,7 +348,7 @@ impl Step for Mingw {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Rustc {
pub compiler: Compiler,
}
Expand Down Expand Up @@ -476,7 +476,7 @@ impl Step for Rustc {
let man_src = builder.src.join("src/doc/man");
let man_dst = image.join("share/man/man1");

// don't use our `bootstrap::{copy, cp_r}`, because those try
// don't use our `bootstrap::{copy_internal, cp_r}`, because those try
// to hardlink, and we don't want to edit the source templates
for file_entry in builder.read_dir(&man_src) {
let page_src = file_entry.path();
Expand Down Expand Up @@ -617,7 +617,7 @@ fn copy_target_libs(builder: &Builder<'_>, target: TargetSelection, image: &Path
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Std {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -664,7 +664,7 @@ impl Step for Std {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct RustcDev {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -723,7 +723,7 @@ impl Step for RustcDev {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Analysis {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -870,7 +870,7 @@ fn copy_src_dirs(
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Src;

impl Step for Src {
Expand Down Expand Up @@ -931,7 +931,7 @@ impl Step for Src {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct PlainSourceTarball;

impl Step for PlainSourceTarball {
Expand Down Expand Up @@ -1031,7 +1031,7 @@ impl Step for PlainSourceTarball {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Cargo {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1080,7 +1080,7 @@ impl Step for Cargo {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Rls {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1122,7 +1122,7 @@ impl Step for Rls {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct RustAnalyzer {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1164,7 +1164,7 @@ impl Step for RustAnalyzer {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Clippy {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1212,7 +1212,7 @@ impl Step for Clippy {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Miri {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1359,7 +1359,7 @@ impl Step for CodegenBackend {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Rustfmt {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1404,7 +1404,7 @@ impl Step for Rustfmt {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct RustDemangler {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -1460,7 +1460,7 @@ impl Step for RustDemangler {
}
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct Extended {
stage: u32,
host: TargetSelection,
Expand Down
20 changes: 10 additions & 10 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ macro_rules! submodule_helper {
macro_rules! book {
($($name:ident, $path:expr, $book_name:expr $(, submodule $(= $submodule:literal)? )? ;)+) => {
$(
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct $name {
target: TargetSelection,
}
Expand Down Expand Up @@ -86,7 +86,7 @@ book!(
StyleGuide, "src/doc/style-guide", "style-guide";
);

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct UnstableBook {
target: TargetSelection,
}
Expand Down Expand Up @@ -160,7 +160,7 @@ impl<P: Step> Step for RustbookSrc<P> {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct TheBook {
compiler: Compiler,
target: TargetSelection,
Expand Down Expand Up @@ -286,7 +286,7 @@ fn invoke_rustdoc(
builder.run(&mut cmd);
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Standalone {
compiler: Compiler,
target: TargetSelection,
Expand Down Expand Up @@ -389,7 +389,7 @@ impl Step for Standalone {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Releases {
compiler: Compiler,
target: TargetSelection,
Expand Down Expand Up @@ -492,7 +492,7 @@ pub struct SharedAssetsPaths {
pub version_info: PathBuf,
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct SharedAssets {
target: TargetSelection,
}
Expand Down Expand Up @@ -872,7 +872,7 @@ macro_rules! tool_doc {
$(is_library = $is_library:expr,)?
$(crates = $crates:expr)?
) => {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct $tool {
target: TargetSelection,
}
Expand Down Expand Up @@ -1021,7 +1021,7 @@ tool_doc!(
crates = ["bootstrap"]
);

#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Ord, PartialOrd, Debug, Clone, Hash, PartialEq, Eq)]
pub struct ErrorIndex {
pub target: TargetSelection,
}
Expand Down Expand Up @@ -1056,7 +1056,7 @@ impl Step for ErrorIndex {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct UnstableBookGen {
target: TargetSelection,
}
Expand Down Expand Up @@ -1112,7 +1112,7 @@ fn symlink_dir_force(config: &Config, original: &Path, link: &Path) {
);
}

#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Ord, PartialOrd, Debug, Clone, Hash, PartialEq, Eq)]
pub struct RustcBook {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ macro_rules! install {
only_hosts: $only_hosts:expr,
$run_item:block $(, $c:ident)*;)+) => {
$(
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct $name {
pub compiler: Compiler,
pub target: TargetSelection,
Expand Down Expand Up @@ -303,7 +303,7 @@ install!((self, builder, _config),
};
);

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Src {
pub stage: u32,
}
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub(crate) fn is_ci_llvm_modified(config: &Config) -> bool {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Llvm {
pub target: TargetSelection,
}
Expand Down Expand Up @@ -815,7 +815,7 @@ fn get_var(var_base: &str, host: &str, target: &str) -> Option<OsString> {
.or_else(|| env::var_os(var_base))
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Lld {
pub target: TargetSelection,
}
Expand Down Expand Up @@ -937,7 +937,7 @@ impl Step for Lld {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Sanitizers {
pub target: TargetSelection,
}
Expand Down Expand Up @@ -1147,7 +1147,7 @@ impl HashStamp {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CrtBeginEnd {
pub target: TargetSelection,
}
Expand Down Expand Up @@ -1215,7 +1215,7 @@ impl Step for CrtBeginEnd {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Libunwind {
pub target: TargetSelection,
}
Expand Down
Loading

0 comments on commit 3d5fd9d

Please sign in to comment.