Skip to content

Commit a96e747

Browse files
committed
fix(check): Do not uplift files to artifact-dir for check builds
1 parent 933fa40 commit a96e747

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/cargo/core/compiler/build_runner/compilation_files.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,13 @@ impl<'a, 'gctx: 'a> CompilationFiles<'a, 'gctx> {
455455
let uplift_path = if unit.target.is_example() {
456456
// Examples live in their own little world.
457457
self.layout(unit.kind)
458-
.artifact_dir()
459-
.expect("artifact-dir was not locked")
458+
.artifact_dir()?
460459
.examples()
461460
.join(filename)
462461
} else if unit.target.is_custom_build() {
463462
self.build_script_dir(unit).join(filename)
464463
} else {
465-
self.layout(unit.kind)
466-
.artifact_dir()
467-
.expect("artifact-dir was not locked")
468-
.dest()
469-
.join(filename)
464+
self.layout(unit.kind).artifact_dir()?.dest().join(filename)
470465
};
471466
if from_path == uplift_path {
472467
// This can happen with things like examples that reside in the

tests/testsuite/check.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,9 +1720,8 @@ fn check_build_should_not_lock_artifact_dir() {
17201720
}
17211721

17221722
// Regression test for #16305
1723-
#[should_panic]
17241723
#[cargo_test]
1725-
fn check_build_should_uplift_proc_macro_dylib_deps() {
1724+
fn check_build_should_not_uplift_proc_macro_dylib_deps() {
17261725
let p = project()
17271726
.file(
17281727
".cargo/config.toml",
@@ -1802,4 +1801,11 @@ fn check_build_should_uplift_proc_macro_dylib_deps() {
18021801
.build();
18031802

18041803
p.cargo("check").enable_mac_dsym().run();
1804+
1805+
p.root()
1806+
.join("target-dir")
1807+
.assert_build_dir_layout(str![[r#"
1808+
[ROOT]/foo/target-dir/CACHEDIR.TAG
1809+
1810+
"#]]);
18051811
}

0 commit comments

Comments
 (0)