-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Warning for misspelling of cargo directives in build scripts #12353
Comments
The challenge with this is that there is a catch-all directive of Similarly, because of this catch-all, we can't actually add new directives... (#11461). However, we have found a way forward as noted in that issue. We'll make a low-probability breaking change of disallowing Work on #11461 was started in #12201 but we were concerned about people using the new syntax on old cargo and ... dropping building directives. So we are looking to have a 6 month or so transition period where |
That's unfortunate. New prefix seems good. Meanwhile I think a crate that provide functions for each directive probably helps. That crate could also check for other footguns, for example warn/error for |
Yes, there has been some interest in having an official Rust API for build scripts. Part of the problem is our processes don't scale up for more crates which we have been working on. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Label this as
S-accepted
#12432 is related somewhat. |
This issue is currently marked as
S-accepted
|
imo this warning would be independent of #12432. The API would help people avoid having typos but not everyone will use it once its available. Hmm, I'm not too sure what is actually left for this after #11461. That PR makes it so misspellings are hard errors but only if you use the new syntax ( |
Problem
Misspelling of cargo directives in build scripts is a huge footgun. For example:
Here cargo will silently ignore the
src/main.rs
file (the typo ischagned
) and one would wonder why their build script is not working. It happend in real world to me, in my case it wasrust-link-lib
instead ofrustc-link-lib
.Proposed Solution
Cargo should warn against any unknown directive in build scripts. Either it is a misspelling, which a warning is very helpful, or it is a directive that newer cargo versions support, which a warning still has useful information, and if ignoring is the desired behavior, user can allow the warning by #12235
Notes
No response
The text was updated successfully, but these errors were encountered: