Skip to content

#[doc(cfg(..)] does not respect check-cfg #138358

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

Open
clubby789 opened this issue Mar 11, 2025 · 2 comments
Open

#[doc(cfg(..)] does not respect check-cfg #138358

clubby789 opened this issue Mar 11, 2025 · 2 comments
Labels
C-bug Category: This is a bug. F-check-cfg --check-cfg F-doc_cfg `#![feature(doc_cfg)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@clubby789
Copy link
Contributor

Original context

check_matches emits a buffered lint, but rustdoc never emits this, so unknown cfgs are silently expected.

@clubby789 clubby789 added C-bug Category: This is a bug. F-doc_cfg `#![feature(doc_cfg)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 11, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 11, 2025
@camelid
Copy link
Member

camelid commented Apr 9, 2025

cc @GuillaumeGomez

@jieyouxu jieyouxu added F-check-cfg --check-cfg and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 10, 2025
@GuillaumeGomez
Copy link
Member

I don't even understand the problem here. I ran locally with:

#![feature(doc_cfg)]

#[cfg(feature = "unk")]
#[doc(cfg(feature = "unk"))]
pub fn f() {}

I added a print after cfg_matches of eprintln!("++++> {:?}", tcx.sess.psess.buffered_lints); and it displays Lock { data: [] }. So I suppose rustc is missing some information to be able to generate warning about this, but which one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-check-cfg --check-cfg F-doc_cfg `#![feature(doc_cfg)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants