Add external macros specific diagnostics for check-cfg by Urgau · Pull Request #133221 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation7 Commits3 Checks6 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
This PR adds specific check-cfg diagnostics for unexpected cfg in external macros.
As well as hiding the some of the Cargo specific help/suggestions as they distraction for external macros and are generally not the right solution.
Follow-up to #132577
@rustbot label +L-unexpected_cfgs
r? compiler
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the changes LGTM, I have one question
Comment on lines +85 to +86
// FIXME: Get access to a `TyCtxt` from an `EarlyContext` |
---|
// crate_name: cx.tcx.crate_name(def_id.krate), |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is this still problematic?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answer: yes, crate_name
is on tcx, early ctxt doesn't have access to a cstore
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine.
📌 Commit e2fbeec has been approved by jieyouxu
It is now in the queue for this repository.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 6 pull requests
Successful merges:
- rust-lang#133221 (Add external macros specific diagnostics for check-cfg)
- rust-lang#133386 (Update linux_musl base to dynamically link the crt by default)
- rust-lang#134191 (Make some types and methods related to Polonius + Miri public)
- rust-lang#134227 (Update wasi-sdk used to build WASI targets)
- rust-lang#134279 ((Re-)return adjustment target if adjust kind is never-to-any)
- rust-lang#134295 (Encode coroutine-closures in SMIR)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 6 pull requests
Successful merges:
- rust-lang#133221 (Add external macros specific diagnostics for check-cfg)
- rust-lang#133386 (Update linux_musl base to dynamically link the crt by default)
- rust-lang#134191 (Make some types and methods related to Polonius + Miri public)
- rust-lang#134227 (Update wasi-sdk used to build WASI targets)
- rust-lang#134279 ((Re-)return adjustment target if adjust kind is never-to-any)
- rust-lang#134295 (Encode coroutine-closures in SMIR)
r? @ghost
@rustbot
modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#133221 - Urgau:check-cfg-macro-diag, r=jieyouxu
Add external macros specific diagnostics for check-cfg
This PR adds specific check-cfg diagnostics for unexpected cfg in external macros.
As well as hiding the some of the Cargo specific help/suggestions as they distraction for external macros and are generally not the right solution.
Follow-up to rust-lang#132577
@rustbot
label +L-unexpected_cfgs
r? compiler
Urgau mentioned this pull request
jieyouxu added a commit to jieyouxu/rust that referenced this pull request
Pass TyCtxt
to early diagostics decoration
This PR pass a TyCtxt
to the early diagnostics decoration code so that diagnostics code that take advantage of (a very limited but still useful) TyCtxt
in their note, help, suggestions, ...
This is particulary useful for rust-lang#133221 which wants to get the crate name of a DefId
, which is possible with tcx.crate_name(...)
.
I highly recommend reviewing this PR commit by commit.
r? @jieyouxu
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#134339 - Urgau:tcx-in-early-diag, r=jieyouxu
Pass TyCtxt
to early diagostics decoration
This PR pass a TyCtxt
to the early diagnostics decoration code so that diagnostics code that take advantage of (a very limited but still useful) TyCtxt
in their note, help, suggestions, ...
This is particulary useful for rust-lang#133221 which wants to get the crate name of a DefId
, which is possible with tcx.crate_name(...)
.
I highly recommend reviewing this PR commit by commit.
r? @jieyouxu
Labels
Lint: unexpected_cfgs
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the compiler team, which will review and decide on the PR/issue.