-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make check-cfg diagnostics work in #[doc(cfg(..))]
#140894
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
Conversation
Some changes occurred in compiler/rustc_attr_parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler changes seem fine
(Unassigning myself to get this out of my review queue, feel free to ping me if this needs a re-review.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small nit, otherwise looks all good to me. Good work! Once fixed, r=me.
@bors r=GuillaumeGomez |
Rollup of 8 pull requests Successful merges: - #140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`) - #140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`) - #141252 (gvn: bail out unavoidable non-ssa locals in repeat) - #141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored) - #141551 (Make two transmute-related MIR lints into HIR lint) - #141591 (ci: fix llvm test coverage) - #141647 (Bump master `stage0` compiler) - #141659 (Add `Result::map_or_default` and `Option::map_or_default`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #140894 - Urgau:check-cfg-rustdoc, r=GuillaumeGomez Make check-cfg diagnostics work in `#[doc(cfg(..))]` This PR makes it so that the check-cfg `unexpected_cfgs` lint, is correctly emitted in `rustdoc`'s `#[doc(cfg(..))]`. This is achieved by adding a custom trait to `cfg_matches` (the method that emits the lint) which permits `rustc` and `rustdoc` to each have their way to emitting lints (via buffered lints/AST for `rustc` and via `TyCtxt`/HIR for `rustdoc`). The reason this is required is because buffered lints operates on the AST but `rustdoc` uses the HIR and by the time `rustdoc` calls `cfg_matches` we are way passed the point where buffered lints have been drain and emitted. Best reviewed commit by commit. r? `@jieyouxu` (for the compiler part) r? `@GuillaumeGomez` (for the rustdoc part)
Rollup of 8 pull requests Successful merges: - rust-lang/rust#140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`) - rust-lang/rust#140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`) - rust-lang/rust#141252 (gvn: bail out unavoidable non-ssa locals in repeat) - rust-lang/rust#141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored) - rust-lang/rust#141551 (Make two transmute-related MIR lints into HIR lint) - rust-lang/rust#141591 (ci: fix llvm test coverage) - rust-lang/rust#141647 (Bump master `stage0` compiler) - rust-lang/rust#141659 (Add `Result::map_or_default` and `Option::map_or_default`) r? `@ghost` `@rustbot` modify labels: rollup
This PR makes it so that the check-cfg
unexpected_cfgs
lint, is correctly emitted inrustdoc
's#[doc(cfg(..))]
.This is achieved by adding a custom trait to
cfg_matches
(the method that emits the lint) which permitsrustc
andrustdoc
to each have their way to emitting lints (via buffered lints/AST forrustc
and viaTyCtxt
/HIR forrustdoc
).The reason this is required is because buffered lints operates on the AST but
rustdoc
uses the HIR and by the timerustdoc
callscfg_matches
we are way passed the point where buffered lints have been drain and emitted.Best reviewed commit by commit.
r? @jieyouxu (for the compiler part)
r? @GuillaumeGomez (for the rustdoc part)