Skip to content

Commit dad833e

Browse files
committed
Let std use proc macros for its compilation
1 parent 9488e41 commit dad833e

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

src/bootstrap/builder.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,13 @@ impl<'a> Builder<'a> {
838838
// already-passed -C metadata flag with our own. Our rustc.rs
839839
// wrapper around the actual rustc will detect -C metadata being
840840
// passed and frob it with this extra string we're passing in.
841-
cargo.env("RUSTC_METADATA_SUFFIX", "rustc");
841+
let suffix = match mode {
842+
Mode::Std => "rustc-std",
843+
Mode::Test => "rustc-test",
844+
Mode::Codegen | Mode::Rustc => "rustc-rustc",
845+
Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => "rustc-tools",
846+
};
847+
cargo.env("RUSTC_METADATA_SUFFIX", suffix);
842848
}
843849

844850
if let Some(x) = self.crt_static(target) {

src/bootstrap/compile.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,28 +1121,28 @@ pub fn run_cargo(builder: &Builder, cargo: &mut Command, stamp: &Path, is_check:
11211121
CargoMessage::CompilerArtifact { filenames, .. } => filenames,
11221122
_ => return,
11231123
};
1124-
for filename in filenames {
1124+
for filename in filenames.iter() {
11251125
// Skip files like executables
11261126
if !filename.ends_with(".rlib") &&
11271127
!filename.ends_with(".lib") &&
11281128
!is_dylib(&filename) &&
11291129
!(is_check && filename.ends_with(".rmeta")) {
1130-
return;
1130+
break;
11311131
}
11321132

1133-
let filename = Path::new(&*filename);
1133+
let filename = Path::new(&**filename);
11341134

11351135
// If this was an output file in the "host dir" we don't actually
11361136
// worry about it, it's not relevant for us.
11371137
if filename.starts_with(&host_root_dir) {
1138-
return;
1138+
break;
11391139
}
11401140

11411141
// If this was output in the `deps` dir then this is a precise file
11421142
// name (hash included) so we start tracking it.
11431143
if filename.starts_with(&target_deps_dir) {
11441144
deps.push(filename.to_path_buf());
1145-
return;
1145+
break;
11461146
}
11471147

11481148
// Otherwise this was a "top level artifact" which right now doesn't
@@ -1163,6 +1163,33 @@ pub fn run_cargo(builder: &Builder, cargo: &mut Command, stamp: &Path, is_check:
11631163

11641164
toplevel.push((file_stem, extension, expected_len));
11651165
}
1166+
for filename in filenames {
1167+
// Skip files like executables
1168+
if !filename.ends_with(".rlib") &&
1169+
!filename.ends_with(".lib") &&
1170+
!is_dylib(&filename) &&
1171+
!(is_check && filename.ends_with(".rmeta")) {
1172+
break;
1173+
}
1174+
1175+
let filename = Path::new(&*filename);
1176+
1177+
// If this was an output file in the "host dir" we don't actually
1178+
// worry about it, it's not relevant for us.
1179+
if filename.starts_with(&host_root_dir) {
1180+
let f = filename.file_name();
1181+
if deps.iter().find(|v| v.file_name() == f).is_none() {
1182+
deps.push(filename.to_path_buf());
1183+
}
1184+
continue;
1185+
}
1186+
1187+
// If this was output in the `deps` dir then this is a precise file
1188+
// name (hash included) so we start tracking it.
1189+
if filename.starts_with(&target_deps_dir) {
1190+
break;
1191+
}
1192+
}
11661193
});
11671194

11681195
if !ok {

0 commit comments

Comments
 (0)