Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,10 @@ pub trait TestEnvCommandExt: Sized {
.env("CARGO_INCREMENTAL", "0")
// Don't read the system git config which is out of our control.
.env("GIT_CONFIG_NOSYSTEM", "1")
// See: https://github.com/rust-lang/rust/pull/159857#issuecomment-5119325932
// This should be removed once the new build-dir layout is stabilized and the old layout
// is removed.
.env("__CARGO_TEMPORARY_BUILD_DIR_NEW_LAYOUT_OPT_OUT", "1")
.env_remove("CI")
.env_remove("__CARGO_DEFAULT_LIB_METADATA")
.env_remove("ALL_PROXY")
Expand Down
12 changes: 4 additions & 8 deletions src/workspace/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,10 @@ macro_rules! unstable_cli_options {
};

// Defaults to enabled on nightly unless explicitly opted out.
unstable.build_dir_new_layout =
matches!(crate::version().release_channel.as_deref(), Some("nightly" | "dev"));
if !is_new_build_dir_layout_opt_out() {
unstable.build_dir_new_layout =
matches!(crate::version().release_channel.as_deref(), Some("nightly" | "dev"));
}

return unstable;
}
Expand Down Expand Up @@ -1286,12 +1288,6 @@ impl CliUnstable {
self.gitoxide = GitoxideFeatures::safe().into();
}

// NOTE: We set this before `implicitly_enable_features_if_needed` as `-Zfine-grain-locking`
// must use the new layout so that takes priority.
if is_new_build_dir_layout_opt_out() {
self.build_dir_new_layout = false;
}

self.implicitly_enable_features_if_needed();

Ok(warnings)
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/build_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,9 +1430,9 @@ fn new_layout_opt_out_nightly() {
)
.build();

p.cargo("-Zbuild-dir-new-layout build")
p.cargo("build")
.env("__CARGO_TEMPORARY_BUILD_DIR_NEW_LAYOUT_OPT_OUT", "1")
.masquerade_as_nightly_cargo(&["new build-dir layout"])
.masquerade_as_nightly_cargo(&["new build-dir layout enabled by default on nightly"])
.enable_mac_dsym()
.run();

Expand Down