Skip to content

Commit 442fc88

Browse files
Auto merge of #145343 - Kobzol:dogfood-z-no-embed-metadata, r=<try>
Dogfood `-Zno-embed-metadata` in the compiler
2 parents 91ee6a4 + 29afe2f commit 442fc88

File tree

13 files changed

+23
-41
lines changed

13 files changed

+23
-41
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,7 @@ impl Step for Std {
103103

104104
let check_stamp =
105105
build_stamp::libstd_stamp(builder, build_compiler, target).with_prefix("check");
106-
run_cargo(
107-
builder,
108-
cargo,
109-
builder.config.free_args.clone(),
110-
&check_stamp,
111-
vec![],
112-
true,
113-
false,
114-
);
106+
run_cargo(builder, cargo, builder.config.free_args.clone(), &check_stamp, vec![], false);
115107

116108
drop(_guard);
117109

@@ -153,7 +145,7 @@ impl Step for Std {
153145
build_compiler,
154146
target,
155147
);
156-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
148+
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], false);
157149
check_stamp
158150
}
159151

@@ -370,7 +362,7 @@ impl Step for Rustc {
370362
let stamp =
371363
build_stamp::librustc_stamp(builder, build_compiler, target).with_prefix("check");
372364

373-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
365+
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], false);
374366

375367
stamp
376368
}
@@ -568,7 +560,7 @@ impl Step for CraneliftCodegenBackend {
568560
)
569561
.with_prefix("check");
570562

571-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
563+
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], false);
572564
}
573565

574566
fn metadata(&self) -> Option<StepMetadata> {
@@ -637,7 +629,7 @@ impl Step for GccCodegenBackend {
637629
)
638630
.with_prefix("check");
639631

640-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
632+
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], false);
641633
}
642634

643635
fn metadata(&self) -> Option<StepMetadata> {
@@ -761,7 +753,7 @@ fn run_tool_check_step(
761753
.with_prefix(&format!("{display_name}-check"));
762754

763755
let _guard = builder.msg(builder.kind, display_name, mode, build_compiler, target);
764-
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
756+
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], false);
765757
}
766758

767759
tool_check_step!(Rustdoc {

src/bootstrap/src/core/build_steps/clippy.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ impl Step for Std {
215215
lint_args(builder, &self.config, IGNORED_RULES_FOR_STD_AND_RUSTC),
216216
&build_stamp::libstd_stamp(builder, build_compiler, target),
217217
vec![],
218-
true,
219218
false,
220219
);
221220
}
@@ -307,7 +306,6 @@ impl Step for Rustc {
307306
lint_args(builder, &self.config, IGNORED_RULES_FOR_STD_AND_RUSTC),
308307
&build_stamp::librustc_stamp(builder, build_compiler, target),
309308
vec![],
310-
true,
311309
false,
312310
);
313311
}
@@ -372,15 +370,7 @@ impl Step for CodegenGcc {
372370
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::Codegen, target))
373371
.with_prefix("rustc_codegen_gcc-check");
374372

375-
run_cargo(
376-
builder,
377-
cargo,
378-
lint_args(builder, &self.config, &[]),
379-
&stamp,
380-
vec![],
381-
true,
382-
false,
383-
);
373+
run_cargo(builder, cargo, lint_args(builder, &self.config, &[]), &stamp, vec![], false);
384374
}
385375

386376
fn metadata(&self) -> Option<StepMetadata> {
@@ -459,7 +449,6 @@ macro_rules! lint_any {
459449
lint_args(builder, &self.config, &[]),
460450
&stamp,
461451
vec![],
462-
true,
463452
false,
464453
);
465454
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ impl Step for Std {
305305
vec![],
306306
&stamp,
307307
target_deps,
308-
self.is_for_mir_opt_tests, // is_check
309308
false,
310309
);
311310

@@ -1149,7 +1148,6 @@ impl Step for Rustc {
11491148
vec![],
11501149
&stamp,
11511150
vec![],
1152-
false,
11531151
true, // Only ship rustc_driver.so and .rmeta files, not all intermediate .rlib files.
11541152
);
11551153

@@ -1617,7 +1615,7 @@ impl Step for GccCodegenBackend {
16171615

16181616
let _guard =
16191617
builder.msg(Kind::Build, "codegen backend gcc", Mode::Codegen, build_compiler, target);
1620-
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false);
1618+
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false);
16211619

16221620
GccCodegenBackendOutput {
16231621
stamp: write_codegen_backend_stamp(stamp, files, builder.config.dry_run()),
@@ -1694,7 +1692,7 @@ impl Step for CraneliftCodegenBackend {
16941692
build_compiler,
16951693
target,
16961694
);
1697-
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false);
1695+
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false);
16981696
write_codegen_backend_stamp(stamp, files, builder.config.dry_run())
16991697
}
17001698

@@ -2416,7 +2414,6 @@ pub fn run_cargo(
24162414
tail_args: Vec<String>,
24172415
stamp: &BuildStamp,
24182416
additional_target_deps: Vec<(PathBuf, DependencyType)>,
2419-
is_check: bool,
24202417
rlib_only_metadata: bool,
24212418
) -> Vec<PathBuf> {
24222419
// `target_root_dir` looks like $dir/$target/release
@@ -2460,7 +2457,7 @@ pub fn run_cargo(
24602457
// Always keep native libraries, rust dylibs and debuginfo
24612458
keep = true;
24622459
}
2463-
if is_check && filename.ends_with(".rmeta") {
2460+
if filename.ends_with(".rmeta") {
24642461
// During check builds we need to keep crate metadata
24652462
keep = true;
24662463
} else if rlib_only_metadata {

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ impl BookTest {
23622362
let stamp = BuildStamp::new(&builder.cargo_out(compiler, mode, target))
23632363
.with_prefix(PathBuf::from(dep).file_name().and_then(|v| v.to_str()).unwrap());
23642364

2365-
let output_paths = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false);
2365+
let output_paths = run_cargo(builder, cargo, vec![], &stamp, vec![], false);
23662366
let directories = output_paths
23672367
.into_iter()
23682368
.filter_map(|p| p.parent().map(ToOwned::to_owned))

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,10 @@ impl Builder<'_> {
10401040
// Enable usage of unstable features
10411041
cargo.env("RUSTC_BOOTSTRAP", "1");
10421042

1043+
if matches!(mode, Mode::Rustc | Mode::Std) {
1044+
cargo.arg("-Zno-embed-metadata");
1045+
}
1046+
10431047
if self.config.dump_bootstrap_shims {
10441048
prepare_behaviour_dump_dir(self.build);
10451049

tests/ui/error-codes/E0152-duplicate-lang-items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//!
44
//! Issue: <https://github.com/rust-lang/rust/issues/31788>
55
6-
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
6+
//@ normalize-stderr: "loaded from .*libstd-.*.rmeta" -> "loaded from SYSROOT/libstd-*.rmeta"
77
//@ dont-require-annotations: NOTE
88

99
#![feature(lang_items)]

tests/ui/error-codes/E0152-duplicate-lang-items.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | | }
99
| |_^
1010
|
1111
= note: the lang item is first defined in crate `std` (which `E0152_duplicate_lang_items` depends on)
12-
= note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
12+
= note: first definition in `std` loaded from SYSROOT/libstd-*.rmeta
1313
= note: second definition in the local crate (`E0152_duplicate_lang_items`)
1414

1515
error: aborting due to 1 previous error

tests/ui/error-codes/E0152.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ normalize-stderr: "loaded from .*liballoc-.*.rlib" -> "loaded from SYSROOT/liballoc-*.rlib"
1+
//@ normalize-stderr: "loaded from .*liballoc-.*.rmeta" -> "loaded from SYSROOT/liballoc-*.rmeta"
22
#![feature(lang_items)]
33

44
#[lang = "owned_box"]

tests/ui/error-codes/E0152.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct Foo<T>(T);
55
| ^^^^^^^^^^^^^^^^^
66
|
77
= note: the lang item is first defined in crate `alloc` (which `std` depends on)
8-
= note: first definition in `alloc` loaded from SYSROOT/liballoc-*.rlib
8+
= note: first definition in `alloc` loaded from SYSROOT/liballoc-*.rmeta
99
= note: second definition in the local crate (`E0152`)
1010

1111
error: aborting due to 1 previous error

tests/ui/lang-items/duplicate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ normalize-stderr: "loaded from .*libcore-.*.rlib" -> "loaded from SYSROOT/libcore-*.rlib"
1+
//@ normalize-stderr: "loaded from .*libcore-.*.rmeta" -> "loaded from SYSROOT/libcore-*.rmeta"
22
#![feature(lang_items)]
33

44
#[lang = "sized"]

0 commit comments

Comments
 (0)