Skip to content
Merged
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
17 changes: 16 additions & 1 deletion src/workspace/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

@epage epage Jul 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to do this without removing Default? This makes it more invasive to undo and redo.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ehh its get awkward to avoid, specially due to #[serde(default)].

I split out a refactor commit and manually impl'd Default in the macro to reduce the bloat and need to update the Default impl when adding new features.
It's still not ideal but maybe a bit better?

#[serde(default, rename_all = "kebab-case")]
pub struct CliUnstable {
$(
Expand All @@ -842,6 +842,21 @@ macro_rules! unstable_cli_options {
fields
}
}
impl Default for CliUnstable {
fn default() -> 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;
}
}

#[cfg(test)]
mod test {
Expand Down