Skip to content

Commit 3d5fd9d

Browse files
authored
Rollup merge of #121570 - Nilstrieb:!copy, r=clubby789
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.
2 parents f548636 + 2401ae1 commit 3d5fd9d

File tree

13 files changed

+99
-99
lines changed

13 files changed

+99
-99
lines changed

src/bootstrap/src/core/build_steps/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl Step for CodegenBackend {
367367
}
368368
}
369369

370-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
370+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
371371
pub struct RustAnalyzer {
372372
pub target: TargetSelection,
373373
}
@@ -441,7 +441,7 @@ impl Step for RustAnalyzer {
441441

442442
macro_rules! tool_check_step {
443443
($name:ident, $path:literal, $($alias:literal, )* $source_type:path $(, $default:literal )?) => {
444-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
444+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
445445
pub struct $name {
446446
pub target: TargetSelection,
447447
}

src/bootstrap/src/core/build_steps/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::utils::cache::Interned;
1414
use crate::utils::helpers::t;
1515
use crate::{Build, Compiler, Mode, Subcommand};
1616

17-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1818
pub struct CleanAll {}
1919

2020
impl Step for CleanAll {

src/bootstrap/src/core/build_steps/compile.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ fn apple_darwin_sign_file(file_path: &Path) {
727727
assert!(status.success());
728728
}
729729

730-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
730+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
731731
pub struct StartupObjects {
732732
pub compiler: Compiler,
733733
pub target: TargetSelection,
@@ -1491,7 +1491,7 @@ pub fn compiler_file(
14911491
PathBuf::from(out.trim())
14921492
}
14931493

1494-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1494+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
14951495
pub struct Sysroot {
14961496
pub compiler: Compiler,
14971497
/// See [`Std::force_recompile`].
@@ -1653,7 +1653,7 @@ impl Step for Sysroot {
16531653
}
16541654
}
16551655

1656-
#[derive(Debug, Copy, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
1656+
#[derive(Debug, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
16571657
pub struct Assemble {
16581658
/// The compiler which we will produce in this step. Assemble itself will
16591659
/// take care of ensuring that the necessary prerequisites to do so exist,

src/bootstrap/src/core/build_steps/dist.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn should_build_extended_tool(builder: &Builder<'_>, tool: &str) -> bool {
5050
builder.config.tools.as_ref().map_or(true, |tools| tools.contains(tool))
5151
}
5252

53-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
53+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
5454
pub struct Docs {
5555
pub host: TargetSelection,
5656
}
@@ -83,7 +83,7 @@ impl Step for Docs {
8383
}
8484
}
8585

86-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
86+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
8787
pub struct JsonDocs {
8888
pub host: TargetSelection,
8989
}
@@ -121,7 +121,7 @@ impl Step for JsonDocs {
121121
}
122122
}
123123

124-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
124+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
125125
pub struct RustcDocs {
126126
pub host: TargetSelection,
127127
}
@@ -308,7 +308,7 @@ fn make_win_dist(
308308
}
309309
}
310310

311-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
311+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
312312
pub struct Mingw {
313313
pub host: TargetSelection,
314314
}
@@ -348,7 +348,7 @@ impl Step for Mingw {
348348
}
349349
}
350350

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

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

620-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
620+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
621621
pub struct Std {
622622
pub compiler: Compiler,
623623
pub target: TargetSelection,
@@ -664,7 +664,7 @@ impl Step for Std {
664664
}
665665
}
666666

667-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
667+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
668668
pub struct RustcDev {
669669
pub compiler: Compiler,
670670
pub target: TargetSelection,
@@ -723,7 +723,7 @@ impl Step for RustcDev {
723723
}
724724
}
725725

726-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
726+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
727727
pub struct Analysis {
728728
pub compiler: Compiler,
729729
pub target: TargetSelection,
@@ -870,7 +870,7 @@ fn copy_src_dirs(
870870
}
871871
}
872872

873-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
873+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
874874
pub struct Src;
875875

876876
impl Step for Src {
@@ -931,7 +931,7 @@ impl Step for Src {
931931
}
932932
}
933933

934-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
934+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
935935
pub struct PlainSourceTarball;
936936

937937
impl Step for PlainSourceTarball {
@@ -1031,7 +1031,7 @@ impl Step for PlainSourceTarball {
10311031
}
10321032
}
10331033

1034-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1034+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
10351035
pub struct Cargo {
10361036
pub compiler: Compiler,
10371037
pub target: TargetSelection,
@@ -1080,7 +1080,7 @@ impl Step for Cargo {
10801080
}
10811081
}
10821082

1083-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1083+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
10841084
pub struct Rls {
10851085
pub compiler: Compiler,
10861086
pub target: TargetSelection,
@@ -1122,7 +1122,7 @@ impl Step for Rls {
11221122
}
11231123
}
11241124

1125-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1125+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
11261126
pub struct RustAnalyzer {
11271127
pub compiler: Compiler,
11281128
pub target: TargetSelection,
@@ -1164,7 +1164,7 @@ impl Step for RustAnalyzer {
11641164
}
11651165
}
11661166

1167-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1167+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
11681168
pub struct Clippy {
11691169
pub compiler: Compiler,
11701170
pub target: TargetSelection,
@@ -1212,7 +1212,7 @@ impl Step for Clippy {
12121212
}
12131213
}
12141214

1215-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1215+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
12161216
pub struct Miri {
12171217
pub compiler: Compiler,
12181218
pub target: TargetSelection,
@@ -1359,7 +1359,7 @@ impl Step for CodegenBackend {
13591359
}
13601360
}
13611361

1362-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1362+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
13631363
pub struct Rustfmt {
13641364
pub compiler: Compiler,
13651365
pub target: TargetSelection,
@@ -1404,7 +1404,7 @@ impl Step for Rustfmt {
14041404
}
14051405
}
14061406

1407-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1407+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
14081408
pub struct RustDemangler {
14091409
pub compiler: Compiler,
14101410
pub target: TargetSelection,
@@ -1460,7 +1460,7 @@ impl Step for RustDemangler {
14601460
}
14611461
}
14621462

1463-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
1463+
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
14641464
pub struct Extended {
14651465
stage: u32,
14661466
host: TargetSelection,

src/bootstrap/src/core/build_steps/doc.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ macro_rules! submodule_helper {
3232
macro_rules! book {
3333
($($name:ident, $path:expr, $book_name:expr $(, submodule $(= $submodule:literal)? )? ;)+) => {
3434
$(
35-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
35+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
3636
pub struct $name {
3737
target: TargetSelection,
3838
}
@@ -86,7 +86,7 @@ book!(
8686
StyleGuide, "src/doc/style-guide", "style-guide";
8787
);
8888

89-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
89+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
9090
pub struct UnstableBook {
9191
target: TargetSelection,
9292
}
@@ -160,7 +160,7 @@ impl<P: Step> Step for RustbookSrc<P> {
160160
}
161161
}
162162

163-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
163+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
164164
pub struct TheBook {
165165
compiler: Compiler,
166166
target: TargetSelection,
@@ -286,7 +286,7 @@ fn invoke_rustdoc(
286286
builder.run(&mut cmd);
287287
}
288288

289-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
289+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
290290
pub struct Standalone {
291291
compiler: Compiler,
292292
target: TargetSelection,
@@ -389,7 +389,7 @@ impl Step for Standalone {
389389
}
390390
}
391391

392-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
392+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
393393
pub struct Releases {
394394
compiler: Compiler,
395395
target: TargetSelection,
@@ -492,7 +492,7 @@ pub struct SharedAssetsPaths {
492492
pub version_info: PathBuf,
493493
}
494494

495-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
495+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
496496
pub struct SharedAssets {
497497
target: TargetSelection,
498498
}
@@ -872,7 +872,7 @@ macro_rules! tool_doc {
872872
$(is_library = $is_library:expr,)?
873873
$(crates = $crates:expr)?
874874
) => {
875-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
875+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
876876
pub struct $tool {
877877
target: TargetSelection,
878878
}
@@ -1021,7 +1021,7 @@ tool_doc!(
10211021
crates = ["bootstrap"]
10221022
);
10231023

1024-
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
1024+
#[derive(Ord, PartialOrd, Debug, Clone, Hash, PartialEq, Eq)]
10251025
pub struct ErrorIndex {
10261026
pub target: TargetSelection,
10271027
}
@@ -1056,7 +1056,7 @@ impl Step for ErrorIndex {
10561056
}
10571057
}
10581058

1059-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1059+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
10601060
pub struct UnstableBookGen {
10611061
target: TargetSelection,
10621062
}
@@ -1112,7 +1112,7 @@ fn symlink_dir_force(config: &Config, original: &Path, link: &Path) {
11121112
);
11131113
}
11141114

1115-
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
1115+
#[derive(Ord, PartialOrd, Debug, Clone, Hash, PartialEq, Eq)]
11161116
pub struct RustcBook {
11171117
pub compiler: Compiler,
11181118
pub target: TargetSelection,

src/bootstrap/src/core/build_steps/install.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ macro_rules! install {
159159
only_hosts: $only_hosts:expr,
160160
$run_item:block $(, $c:ident)*;)+) => {
161161
$(
162-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
162+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
163163
pub struct $name {
164164
pub compiler: Compiler,
165165
pub target: TargetSelection,
@@ -303,7 +303,7 @@ install!((self, builder, _config),
303303
};
304304
);
305305

306-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
306+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
307307
pub struct Src {
308308
pub stage: u32,
309309
}

src/bootstrap/src/core/build_steps/llvm.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub(crate) fn is_ci_llvm_modified(config: &Config) -> bool {
242242
}
243243
}
244244

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

818-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
818+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
819819
pub struct Lld {
820820
pub target: TargetSelection,
821821
}
@@ -937,7 +937,7 @@ impl Step for Lld {
937937
}
938938
}
939939

940-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
940+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
941941
pub struct Sanitizers {
942942
pub target: TargetSelection,
943943
}
@@ -1147,7 +1147,7 @@ impl HashStamp {
11471147
}
11481148
}
11491149

1150-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1150+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
11511151
pub struct CrtBeginEnd {
11521152
pub target: TargetSelection,
11531153
}
@@ -1215,7 +1215,7 @@ impl Step for CrtBeginEnd {
12151215
}
12161216
}
12171217

1218-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1218+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
12191219
pub struct Libunwind {
12201220
pub target: TargetSelection,
12211221
}

0 commit comments

Comments
 (0)