From c9d731067df7bd84135484c03863a609224989c5 Mon Sep 17 00:00:00 2001 From: Ross Sullivan Date: Fri, 24 Jul 2026 10:45:37 +0900 Subject: [PATCH 1/2] refactor: Don't derive Default on CliUnstable --- src/workspace/features.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/workspace/features.rs b/src/workspace/features.rs index 6a270d9af9e..3a0f6bcd725 100644 --- a/src/workspace/features.rs +++ b/src/workspace/features.rs @@ -826,7 +826,7 @@ macro_rules! unstable_cli_options { /// Cargo, like `rustc`, accepts a suite of `-Z` flags which are intended for /// gating unstable functionality to Cargo. These flags are only available on /// the nightly channel of Cargo. - #[derive(Default, Debug, Deserialize)] + #[derive(Debug, Deserialize)] #[serde(default, rename_all = "kebab-case")] pub struct CliUnstable { $( @@ -842,6 +842,15 @@ macro_rules! unstable_cli_options { fields } } + impl Default for CliUnstable { + fn default() -> Self { + Self { + $( + $element: Default::default() + ),* + } + } + } #[cfg(test)] mod test { From d035da685049f5f254082a029d9267970fed3204 Mon Sep 17 00:00:00 2001 From: Ross Sullivan Date: Fri, 24 Jul 2026 13:53:45 +0900 Subject: [PATCH 2/2] feat: Enable build-dir layout v2 on nightly --- src/workspace/features.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/workspace/features.rs b/src/workspace/features.rs index 3a0f6bcd725..8d29ecf4c43 100644 --- a/src/workspace/features.rs +++ b/src/workspace/features.rs @@ -844,11 +844,17 @@ macro_rules! unstable_cli_options { } impl Default for CliUnstable { fn default() -> Self { - Self { + let mut unstable = Self { $( $element: Default::default() ),* - } + }; + + // Defaults to enabled on nightly unless explicitly opted out. + unstable.build_dir_new_layout = + matches!(crate::version().release_channel.as_deref(), Some("nightly" | "dev")); + + return unstable; } }