Skip to content

Commit 0e3a7e6

Browse files
committed
Auto merge of rust-lang#140357 - onur-ozkan:133840, r=<try>
bypass linker configuration and cross target check on `x check` I was going to handle this using the untracked env approach, but I realized it somehow doesn't regress rust-lang#130108 anymore... Anyway, if it works, it works. 😄 No need to dig deeper but my guess is we moved some cache-invalidating env from these functions to others. Fixes rust-lang#133840 try-job: aarch64-apple
2 parents 54d024e + a8f7fd1 commit 0e3a7e6

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ impl Cargo {
112112
let mut cargo = builder.cargo(compiler, mode, source_type, target, cmd_kind);
113113

114114
match cmd_kind {
115-
// No need to configure the target linker for these command types,
116-
// as they don't invoke rustc at all.
117-
Kind::Clean | Kind::Suggest | Kind::Format | Kind::Setup => {}
115+
// No need to configure the target linker for these command types.
116+
Kind::Clean | Kind::Check | Kind::Suggest | Kind::Format | Kind::Setup => {}
118117
_ => {
119118
cargo.configure_linker(builder);
120119
}
@@ -205,6 +204,8 @@ impl Cargo {
205204
self
206205
}
207206

207+
// FIXME(onur-ozkan): Add coverage to make sure modifications to this function
208+
// doesn't cause cache invalidations (e.g., #130108).
208209
fn configure_linker(&mut self, builder: &Builder<'_>) -> &mut Cargo {
209210
let target = self.target;
210211
let compiler = self.compiler;

src/bootstrap/src/utils/cc_detect.rs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub fn find(build: &Build) {
9696
let targets: HashSet<_> = match build.config.cmd {
9797
// We don't need to check cross targets for these commands.
9898
crate::Subcommand::Clean { .. }
99+
| crate::Subcommand::Check { .. }
99100
| crate::Subcommand::Suggest { .. }
100101
| crate::Subcommand::Format { .. }
101102
| crate::Subcommand::Setup { .. } => {

src/bootstrap/src/utils/cc_detect/tests.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn test_language_clang() {
181181

182182
#[test]
183183
fn test_new_cc_build() {
184-
let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
184+
let build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
185185
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
186186
let cfg = new_cc_build(&build, target.clone());
187187
let compiler = cfg.get_compiler();
@@ -190,7 +190,7 @@ fn test_new_cc_build() {
190190

191191
#[test]
192192
fn test_default_compiler_wasi() {
193-
let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
193+
let build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
194194
let target = TargetSelection::from_user("wasm32-wasi");
195195
let wasi_sdk = PathBuf::from("/wasi-sdk");
196196
// SAFETY: bootstrap tests run on a single thread
@@ -215,7 +215,7 @@ fn test_default_compiler_wasi() {
215215

216216
#[test]
217217
fn test_default_compiler_fallback() {
218-
let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
218+
let build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
219219
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
220220
let mut cfg = cc::Build::new();
221221
let result = default_compiler(&mut cfg, Language::C, target, &build);
@@ -224,7 +224,7 @@ fn test_default_compiler_fallback() {
224224

225225
#[test]
226226
fn test_find_target_with_config() {
227-
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
227+
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
228228
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
229229
let mut target_config = Target::default();
230230
target_config.cc = Some(PathBuf::from("dummy-cc"));
@@ -249,7 +249,7 @@ fn test_find_target_with_config() {
249249

250250
#[test]
251251
fn test_find_target_without_config() {
252-
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
252+
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
253253
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
254254
build.config.target_config.clear();
255255
find_target(&build, target.clone());
@@ -262,7 +262,7 @@ fn test_find_target_without_config() {
262262

263263
#[test]
264264
fn test_find() {
265-
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
265+
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
266266
let target1 = TargetSelection::from_user("x86_64-unknown-linux-gnu");
267267
let target2 = TargetSelection::from_user("x86_64-unknown-openbsd");
268268
build.targets.push(target1.clone());

0 commit comments

Comments
 (0)