-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-doc_cfg`#![feature(doc_cfg)]``#![feature(doc_cfg)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code:
#![feature(doc_cfg)]
#[doc(cfg(x, y))]
fn bar() {}
I expected to see this happen: An error, to match the behavior on #[cfg(x, y)]
:
error: multiple `cfg` predicates are specified
--> cfg2.rs:1:10
|
1 | #[cfg(x, y)]
| ^
Instead, this happened: Rustdoc silently accepts the code.
Relevant code:
rust/src/librustdoc/clean/cfg.rs
Line 62 in 88b99de
crate fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> { |
I think the relevant rustc code is
rust/compiler/rustc_expand/src/config.rs
Line 455 in 88b99de
fn in_cfg(&self, attrs: &[Attribute]) -> bool { |
Meta
rustdoc --version
: rustdoc 1.53.0-nightly (392ba2b 2021-04-17)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-doc_cfg`#![feature(doc_cfg)]``#![feature(doc_cfg)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.