about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorWim Looman <git@nemo157.com>2020-11-04 21:59:35 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-10-05 18:04:15 +0200
commit18fdd816b72cbf1547efbb81f164f7a457f17b78 (patch)
tree838520193f9832ddafa6ab4977b415edf5f0208a /src/test/rustdoc
parent10cdbd847fd00d093ce89a4fffde5d90c8bb9817 (diff)
downloadrust-18fdd816b72cbf1547efbb81f164f7a457f17b78.tar.gz
rust-18fdd816b72cbf1547efbb81f164f7a457f17b78.zip
Allow adding a set of cfg's to hide from being implicitly doc(cfg)'d
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg
 #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly
treated as a doc(cfg) to render a message in the documentation.
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/doc-cfg-hide.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/rustdoc/doc-cfg-hide.rs b/src/test/rustdoc/doc-cfg-hide.rs
new file mode 100644
index 00000000000..b9d0d323137
--- /dev/null
+++ b/src/test/rustdoc/doc-cfg-hide.rs
@@ -0,0 +1,32 @@
+#![crate_name = "oud"]
+#![feature(doc_cfg, doc_cfg_hide)]
+
+#![doc(cfg_hide(feature = "solecism"))]
+
+// @has 'oud/struct.Solecism.html'
+// @count   - '//*[@class="stab portability"]' 0
+// compile-flags:--cfg feature="solecism"
+#[cfg(feature = "solecism")]
+pub struct Solecism;
+
+// @has 'oud/struct.Scribacious.html'
+// @count   - '//*[@class="stab portability"]' 1
+// @matches - '//*[@class="stab portability"]' 'crate feature solecism'
+#[cfg(feature = "solecism")]
+#[doc(cfg(feature = "solecism"))]
+pub struct Scribacious;
+
+// @has 'oud/struct.Hyperdulia.html'
+// @count   - '//*[@class="stab portability"]' 1
+// @matches - '//*[@class="stab portability"]' 'crate feature hyperdulia'
+// compile-flags:--cfg feature="hyperdulia"
+#[cfg(feature = "solecism")]
+#[cfg(feature = "hyperdulia")]
+pub struct Hyperdulia;
+
+// @has 'oud/struct.Oystercatcher.html'
+// @count   - '//*[@class="stab portability"]' 1
+// @matches - '//*[@class="stab portability"]' 'crate features solecism and oystercatcher'
+// compile-flags:--cfg feature="oystercatcher"
+#[cfg(all(feature = "solecism", feature = "oystercatcher"))]
+pub struct Oystercatcher;