Move check-cfg lints to rustc_attr_parsing
#149215
Draft
+504
−532
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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