Cargo change in workspace default-members

We'd like to get feedback on a proposed change to the default-members workspace setting in Cargo. None of the team members have used this feature, so we don't have a good impression of what the implications are. If you use default-members, please leave a comment here if you think this change would cause a positive or negative effect on your project and workflows.

For context: default-members is a setting you can add to Cargo.toml to specify which packages in a workspace will be built by default.

Currently, Cargo uses the default-members setting regardless of which directory you are in. The proposed change is that if you change directories to a workspace member, then it will only build that member, and will ignore default-members. This means that default-members would only be used if you are in the root of the workspace.

More information can be found at https://github.com/rust-lang/cargo/issues/5932

We'd appreciate any feedback you have!

5 Likes

I've not used default-members personally, but I agree with the proposed behavior: default-members should just change the default --all behavior when running cargo against the virtual manifest.

The behavior of running cargo in a subdirectory definitely shouldn't change depending on whether default-members is present or not.

2 Likes

A project I work on uses default-members, and we have consistently been surprised by the current behaviour. I've had to explain it multiple times, basically whenever someone joins the team. I think the change would be a positive one.

1 Like