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

Fix false-positives from target-specific optional features #375

Merged
merged 5 commits into from
Feb 21, 2023

Conversation

tonowak
Copy link
Collaborator

@tonowak tonowak commented Feb 20, 2023

Fixes #369

@tonowak
Copy link
Collaborator Author

tonowak commented Feb 20, 2023

Is there a situation where we don't want to look into target-specific dependencies?

@tonowak
Copy link
Collaborator Author

tonowak commented Feb 20, 2023

By the way, this change doesn't apply to crates-index::Version, because it doesn't differentiate between targets and their dependencies.

Comment on lines 53 to 55
for target in manifest.parsed.target.values() {
dependencies.extend(target.dependencies.clone().into_iter());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does enabling target-specific dependencies behave when the target isn't being built?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cargo new targetspecific
cd targetspecific
echo "[target.'cfg(windows)'.dependencies]" >> Cargo.toml
echo 'async-std = { version = "1.6.2", optional = true }' >> Cargo.toml
cargo run --features async-std

It seems to work on a unix machine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like that would be a good test to have in the repo documented specifically for this purpose rather than relying only on the third-party reproductions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in 2c2e7c9.

@obi1kenobi obi1kenobi changed the title Fix #369 Fix false-positives from target-specific optional features Feb 21, 2023
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.

Implicit features due to target-specific optional dependencies are not added in current version
3 participants