about summary refs log tree commit diff
path: root/tests/rustdoc-ui/doc-cfg-check-cfg.rs
blob: 7d37077a32ddc27e56fdc7ccac1b84d3678a01f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Ensure that `doc(cfg())` respects `check-cfg`
// Currently not properly working

//@ check-pass
//@ no-auto-check-cfg

//@ revisions: no_check cfg_empty cfg_foo
//@[cfg_empty] compile-flags: --check-cfg cfg()
//@[cfg_foo] compile-flags: --check-cfg cfg(foo)

#![feature(doc_cfg)]
#![doc(cfg(foo))]
//[cfg_empty]~^ WARN unexpected `cfg` condition name: `foo`

#[doc(cfg(foo))]
//[cfg_empty]~^ WARN unexpected `cfg` condition name: `foo`
pub fn foo() {}

#[doc(cfg(foo))]
//[cfg_empty]~^ WARN unexpected `cfg` condition name: `foo`
pub mod module {
    #[allow(unexpected_cfgs)]
    #[doc(cfg(bar))]
    pub fn bar() {}
}