File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,12 @@ impl Layout {
151151 // actual destination (sub)subdirectory.
152152 paths:: create_dir_all ( dest. as_path_unlocked ( ) ) ?;
153153
154- let build_dir_lock = if root == build_root || is_on_nfs_mount ( build_root. as_path_unlocked ( ) )
154+ // We always need to take the build-dir lock but if the build-dir == artifact-dir then we
155+ // only take the artifact-dir. (locking both as they are the same dir)
156+ // However we need to take into account that for some builds like `cargo check` we avoid
157+ // locking the artifact-dir. We still need to lock the build-dir to avoid file corruption.
158+ let build_dir_lock = if ( must_take_artifact_dir_lock && root == build_root)
159+ || is_on_nfs_mount ( build_root. as_path_unlocked ( ) )
155160 {
156161 None
157162 } else {
Original file line number Diff line number Diff line change @@ -1710,13 +1710,13 @@ fn check_build_should_not_output_files_to_artifact_dir() {
17101710}
17111711
17121712#[ cargo_test]
1713- fn check_build_should_not_lock_artifact_dir ( ) {
1713+ fn check_build_should_lock_target_dir_when_artifact_dir_is_same_as_build_dir ( ) {
17141714 let p = project ( )
17151715 . file ( "src/main.rs" , r#"fn main() { println!("Hello, World!") }"# )
17161716 . build ( ) ;
17171717
17181718 p. cargo ( "check" ) . enable_mac_dsym ( ) . run ( ) ;
1719- assert ! ( ! p. root( ) . join( "target/debug/.cargo-lock" ) . exists( ) ) ;
1719+ assert ! ( p. root( ) . join( "target/debug/.cargo-lock" ) . exists( ) ) ;
17201720}
17211721
17221722#[ cargo_test]
You can’t perform that action at this time.
0 commit comments