-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc: Stricter matching of --cfg
options
#31530
rustc: Stricter matching of --cfg
options
#31530
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
A couple questions:
|
--cfg
options on rustc--cfg
options
I think that this still wants to parse a meta instead of an ident to we can still pass, for example, For tests you can add some |
@alexcrichton: If that's the case, then would it make sense to do some basic validation (perhaps with a simple visitor pattern) of the tree produced by the meta parser? |
It may make the most sense to just make sure there are no more tokens in the parser once a meta item is parsed (although I'm not sure how to do this). I think what's happening here is we're successfully parsing a meta item and we're just trashing the remaining tokens (when they should be considered invalid) |
Oooh, good point! I'll look into that. |
Includes compile-fail test to check that it fails on incomplete `--cfg` matches. Fixes rust-lang#31497.
dd56425
to
b122064
Compare
@alexcrichton: Comments addressed and compile-fail test added! |
@alexcrichton: Thank you for pointing me in the right direction! 😄 That got me to take another at the parser it uses under the hood and discover the very handy |
⌛ Testing commit b122064 with merge b6ca777... |
Looks like there's something in the build script that is causing |
💔 Test failed - auto-linux-musl-64-opt |
Ah that's because that's legitimately an invalid cfg! That should probably change to |
@alexcrichton: Huh, so I can see a Edit: Nevermind, found it here. |
This is because the tool compiler passes the name of the tool as a command line `--cfg`. The improved session config parser is stricter and no longer permits invalid meta items (such as "error-index-generator").
@alexcrichton: Turns out the fix was a simple (and probably overdue) rename! See 2766e25. |
Fixes #31497.