Skip to content

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

@clubby789

Description

@clubby789
Contributor

Original context

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

Activity

added
C-bugCategory: This is a bug.
F-doc_cfg`#![feature(doc_cfg)]`
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
on Mar 11, 2025
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 11, 2025
camelid

camelid commented on Apr 9, 2025

@camelid
Member
added and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 10, 2025
GuillaumeGomez

GuillaumeGomez commented on Apr 10, 2025

@GuillaumeGomez
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-check-cfg--check-cfgF-doc_cfg`#![feature(doc_cfg)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @GuillaumeGomez@clubby789@camelid@jieyouxu@rustbot

        Issue actions

          `#[doc(cfg(..)]` does not respect `check-cfg` · Issue #138358 · rust-lang/rust