about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorWim Looman <git@nemo157.com>2020-11-03 19:45:16 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-10-05 17:25:44 +0200
commit10cdbd847fd00d093ce89a4fffde5d90c8bb9817 (patch)
tree565637fa1346110af2b1b1aa415cd1d1b2fe025a /src/librustdoc/html/render
parent074f63648bd2368d5ca19aed02b5763a144e5d05 (diff)
downloadrust-10cdbd847fd00d093ce89a4fffde5d90c8bb9817.tar.gz
rust-10cdbd847fd00d093ce89a4fffde5d90c8bb9817.zip
Make cfg implicitly imply doc(cfg)
This is only active when the `doc_cfg` feature is active.

The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to
hide a #[cfg] you can use something like:

```rust
 #[cfg(unix)]
 #[doc(cfg(all()))]
pub struct Unix;
```

(since `all()` is always true, it is never shown in the docs)
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/print_item.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 28b2eded7cc..e68e1223171 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -323,7 +323,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
                     let import_item = clean::Item {
                         def_id: import_def_id.into(),
                         attrs: import_attrs,
-                        cfg: ast_attrs.cfg(cx.sess()),
+                        cfg: ast_attrs.cfg(cx.tcx()),
                         ..myitem.clone()
                     };