-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Move check-cfg lints to rustc_attr_parsing
#149215
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
|
Does it mean we would get warnings for non-active cfg attributes? #[cfg(target_os = "lol")] // warn and not active
#[cfg(unknown)] // currently doesn't warn, since above is not active, but will it with this PR?
fn foo() {}Regarding the non-accessible |
abb82ad to
4ee0f66
Compare
This comment has been minimized.
This comment has been minimized.
4ee0f66 to
f5e9e93
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Attributes that are configured out (like in your example) are currently not parsed, and therefore this would not cause this warning, preserving the old behavior. I didn't think of this edgecase so I'll make sure to add a test for this. Indeed currently attribute lints are special and not emitted as a builtin lint. I'm gonna play around with this a bit and see if anything is stopping me from changing that |
…r=Urgau Run `eval_config_entry` on all branches so we always emit lints Fixes rust-lang#149090 Ideally I'd have liked to fix this issue using rust-lang#149215, and this is still the long term plan, but this is slightly more annoying to implement than I'd have liked to, and this is also a nice and easy solution to the problem. r? `@tgross35`
Rollup merge of #149380 - JonathanBrouwer:cfg_select_lints, r=Urgau Run `eval_config_entry` on all branches so we always emit lints Fixes #149090 Ideally I'd have liked to fix this issue using #149215, and this is still the long term plan, but this is slightly more annoying to implement than I'd have liked to, and this is also a nice and easy solution to the problem. r? `@tgross35`
Run `eval_config_entry` on all branches so we always emit lints Fixes rust-lang/rust#149090 Ideally I'd have liked to fix this issue using rust-lang/rust#149215, and this is still the long term plan, but this is slightly more annoying to implement than I'd have liked to, and this is also a nice and easy solution to the problem. r? `@tgross35`
|
☔ The latest upstream changes (presumably #149410) made this pull request unmergeable. Please resolve the merge conflicts. |
Run `eval_config_entry` on all branches so we always emit lints Fixes rust-lang/rust#149090 Ideally I'd have liked to fix this issue using rust-lang/rust#149215, and this is still the long term plan, but this is slightly more annoying to implement than I'd have liked to, and this is also a nice and easy solution to the problem. r? `@tgross35`
The goal of this PR is to make the
eval_config_entrynot have any side effects, by moving the check-cfg lints to the attribute parsing. This also helps ensure we do emit the lint in situations where the attribute happens to be parsed, but never evaluated. This happens to some cases of the#[link]attribute and some cases of thecfg_select!macro.Still a draft, so no need to review yet, because:
TyCtxtfrom thecargo_macro_helphint, I want to see if there is a way to undo this because the hint was quite nice. For this to work we need to emit early lints for attribute parsing later, because the current place they're emitted does not have access to theTyCtxt. I think this should be doable.cc @jdonszelmann @Urgau for a vibe check if you feel like it
Fixes #149090