Skip to content

suggest workspace hints for boolean dependencies #15507

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

borngraced
Copy link

What does this PR try to resolve?

via issue #15505, Cargo currently errors on

[dependencies]
crc32fast = true

with a message about expected a version string or a detailed dependency It doesn’t hint that you can depend on a workspace member. This PR updates cargo so that when you write dep = true, the error also suggests:

dep = { workspace = true }
dep.workspace = true

How should we test and review this PR?

In a workspace crate’s Cargo.toml, add

[dependencies]
crc32fast = true

Run cargo build and you should see the enhanced error with the two workspace hints.

Additional information

Regarding support for int/float, we only need a special case for boolean because they’re the only values that get the workspace hint. Everything else just uses the normal detailed dependency error

@rustbot
Copy link
Collaborator

rustbot commented May 9, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-manifest Area: Cargo.toml issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 9, 2025
@epage
Copy link
Contributor

epage commented May 9, 2025

Mind squashing that last commit into the previous one?

hint for only bad dependency true literal and rename unit test to match
@borngraced borngraced force-pushed the workspace-hint-boolean-deps branch from f47ac3a to b3ce3eb Compare May 9, 2025 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-manifest Area: Cargo.toml issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants