about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-10-06 20:06:33 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-10-06 21:22:56 +0200
commit09c76884bc6ba1957dc6d71d79b797de2cc40b2d (patch)
tree5907782acf32122f2df333fea121d513a495bad4 /src/test
parent8fac41a530d3add62464292066130c266a303258 (diff)
downloadrust-09c76884bc6ba1957dc6d71d79b797de2cc40b2d.tar.gz
rust-09c76884bc6ba1957dc6d71d79b797de2cc40b2d.zip
Simplify AttributesExt::cfg function and remove error emissions since they are not useful
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/doc-cfg.rs9
-rw-r--r--src/test/rustdoc-ui/doc-cfg.stderr26
2 files changed, 35 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/doc-cfg.rs b/src/test/rustdoc-ui/doc-cfg.rs
new file mode 100644
index 00000000000..354d76bc3c4
--- /dev/null
+++ b/src/test/rustdoc-ui/doc-cfg.rs
@@ -0,0 +1,9 @@
+#![feature(doc_cfg)]
+
+#[doc(cfg(), cfg(foo, bar))]
+//~^ ERROR
+//~^^ ERROR
+#[doc(cfg(foo), cfg(bar))] // ok!
+#[doc(cfg())] //~ ERROR
+#[doc(cfg(foo, bar))] //~ ERROR
+pub fn foo() {}
diff --git a/src/test/rustdoc-ui/doc-cfg.stderr b/src/test/rustdoc-ui/doc-cfg.stderr
new file mode 100644
index 00000000000..b379f6febe2
--- /dev/null
+++ b/src/test/rustdoc-ui/doc-cfg.stderr
@@ -0,0 +1,26 @@
+error: `cfg` predicate is not specified
+  --> $DIR/doc-cfg.rs:3:7
+   |
+LL | #[doc(cfg(), cfg(foo, bar))]
+   |       ^^^^^
+
+error: multiple `cfg` predicates are specified
+  --> $DIR/doc-cfg.rs:3:23
+   |
+LL | #[doc(cfg(), cfg(foo, bar))]
+   |                       ^^^
+
+error: `cfg` predicate is not specified
+  --> $DIR/doc-cfg.rs:7:7
+   |
+LL | #[doc(cfg())]
+   |       ^^^^^
+
+error: multiple `cfg` predicates are specified
+  --> $DIR/doc-cfg.rs:8:16
+   |
+LL | #[doc(cfg(foo, bar))]
+   |                ^^^
+
+error: aborting due to 4 previous errors
+