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

Warn about unrecognized sections #5264

Closed
jdm opened this issue Mar 29, 2018 · 7 comments
Closed

Warn about unrecognized sections #5264

jdm opened this issue Mar 29, 2018 · 7 comments
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. S-triage Status: This issue is waiting on initial triage.

Comments

@jdm
Copy link

jdm commented Mar 29, 2018

I regularly misspell patch overrides as [path."https://github.com/foo/bar"], and it's always quite frustrating and easy to overlook while I'm trying to figure out why my override isn't taking effect.

@alexcrichton alexcrichton added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Mar 29, 2018
@iancormac84
Copy link

I'm interested in working on this, please. I believe I'll have to look for the code to parse the Cargo.toml manifests?

@alexcrichton
Copy link
Member

@iancormac84 awesome! All the code for that is in cargo::util::toml currently, and while we do have code for processing unused manifest keys for some reason it's not catching the above!

@iancormac84
Copy link

So my proposed plan of action is to use lev_distance to detect strings that may be referring to a 'patch' section and then warn about a possible mistake. How does that sound? Any other suggested manifest keys that may need a little warning attention while I'm at it?

@kellerkindt
Copy link

kellerkindt commented Jul 26, 2021

Well, I just fell for this. A hint would have saved me quite few minutes. Try to spot the error:

serde = { version = "1.0.126", optional = true, feautres = ["derive"] }
$ cargo build
...
error[E0433]: failed to resolve: could not find `Deserialize` in `serde`
...
Solution

feautres (wrong)
features(correct)

@epage
Copy link
Contributor

epage commented May 24, 2023

See also #3576

@weihanglo
Copy link
Member

We already have serde_ignore to catch all unused keys, I believe this should already be resolved. Some sections accepting arbitrary keys are required special cares. I lean towards tackling them one by one if there is an issue.

What else do we need to handle?

  • [replace]? Though it is deprecated I am reluctant to put efforts on it.
  • [target.<platform>.dependencies]? It's nearly impossible to check whether a platform is valid or not.
  • [lints]? We should keep an eye on this as it is deserialized to toml::Value. For now it is handled very well.

@weihanglo
Copy link
Member

Going to close this. If you have encountered any similar issue with a newer Cargo. Please leave a comment or file a new issue report.

For the three remaining items mentioned in #5264 (comment), I personally don't think they are worth fixing. If anyone wants to do it, please file a new issue and we can start the discussion.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

6 participants