Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to workspace if workspace_default_members is unavailable #80

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

foresterre
Copy link

@foresterre foresterre commented Jan 3, 2025

NB: Draft because it requires a new release of https://github.com/oli-obk/cargo_metadata (which will include the new API's which can be used to check the presence of the the workspace_default_members field oli-obk/cargo_metadata#282)

When cargo_metadata is invoked with a Cargo version < 1.71, which doesn't support workspace default members, the workspace_default_members field in cargo_metadata will be empty. Dereferencing this field will then cause a panic. To prevent partition_packages to panic when used with older Cargo versions, we check the presence of the field, and if it is missing, we default to the workspace instead.

Do you agree that selecting the workspace, if workspace_default_members is unavailable, would be the right behaviour?

fixes #62

See also: issue oli-obk/cargo_metadata#254 "Don't panic from WorkspaceDefaultMembers?"

…ilable

When cargo_metadata is invoked with a Cargo version < 1.71, which doesn't support workspace default members, the workspace_default_members field in cargo_metadata will be empty. Dereferencing this field will then cause a panic. To prevent partition_packages to panic when used with older Cargo versions, we check the presence of the field, and if it is missing, we default to the workspace instead.
@foresterre foresterre force-pushed the refactor/workspace-default-members-in-partition branch from 907f261 to 1c42b8b Compare January 24, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid panic when using partition_packages on Rust < 1.71
1 participant