about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-ui/doc-cfg.rs9
-rw-r--r--tests/rustdoc-ui/doc-cfg.stderr66
-rw-r--r--tests/rustdoc-ui/feature-gate-doc_cfg.rs6
-rw-r--r--tests/rustdoc-ui/feature-gate-doc_cfg.stderr63
-rw-r--r--tests/rustdoc-ui/feature-gate-doc_cfg_hide.rs8
-rw-r--r--tests/rustdoc-ui/feature-gate-doc_cfg_hide.stderr10
-rw-r--r--tests/rustdoc-ui/lints/doc_cfg_hide.stderr2
7 files changed, 128 insertions, 36 deletions
diff --git a/tests/rustdoc-ui/doc-cfg.rs b/tests/rustdoc-ui/doc-cfg.rs
index 14943bbc341..9840c305290 100644
--- a/tests/rustdoc-ui/doc-cfg.rs
+++ b/tests/rustdoc-ui/doc-cfg.rs
@@ -8,4 +8,13 @@
 //~^^ WARN unexpected `cfg` condition name: `bar`
 #[doc(cfg())] //~ ERROR
 #[doc(cfg(foo, bar))] //~ ERROR
+#[doc(auto_cfg(42))] //~ ERROR
+#[doc(auto_cfg(hide(true)))] //~ ERROR
+#[doc(auto_cfg(hide(42)))] //~ ERROR
+#[doc(auto_cfg(hide("a")))] //~ ERROR
+#[doc(auto_cfg(hide(foo::bar)))] //~ ERROR
+// Shouldn't lint
+#[doc(auto_cfg(hide(windows)))]
+#[doc(auto_cfg(hide(feature = "windows")))]
+#[doc(auto_cfg(hide(foo)))]
 pub fn foo() {}
diff --git a/tests/rustdoc-ui/doc-cfg.stderr b/tests/rustdoc-ui/doc-cfg.stderr
index 1233ee010de..36ca18eed8f 100644
--- a/tests/rustdoc-ui/doc-cfg.stderr
+++ b/tests/rustdoc-ui/doc-cfg.stderr
@@ -1,26 +1,34 @@
-error: `cfg` predicate is not specified
-  --> $DIR/doc-cfg.rs:3:7
+error: `only "hide" or "show" are allowed in "#[doc(auto_cfg(...))]"`
+  --> $DIR/doc-cfg.rs:11:7
    |
-LL | #[doc(cfg(), cfg(foo, bar))]
-   |       ^^^^^ help: expected syntax is: `cfg(/* predicate */)`
+LL | #[doc(auto_cfg(42))]
+   |       ^^^^^^^^^^^^
+   |
+   = note: `#[deny(invalid_doc_attributes)]` on by default
 
-error: multiple `cfg` predicates are specified
-  --> $DIR/doc-cfg.rs:3:23
+error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
+  --> $DIR/doc-cfg.rs:12:21
    |
-LL | #[doc(cfg(), cfg(foo, bar))]
-   |                       ^^^
+LL | #[doc(auto_cfg(hide(true)))]
+   |                     ^^^^
 
-error: `cfg` predicate is not specified
-  --> $DIR/doc-cfg.rs:9:7
+error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
+  --> $DIR/doc-cfg.rs:13:21
    |
-LL | #[doc(cfg())]
-   |       ^^^^^ help: expected syntax is: `cfg(/* predicate */)`
+LL | #[doc(auto_cfg(hide(42)))]
+   |                     ^^
 
-error: multiple `cfg` predicates are specified
-  --> $DIR/doc-cfg.rs:10:16
+error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
+  --> $DIR/doc-cfg.rs:14:21
    |
-LL | #[doc(cfg(foo, bar))]
-   |                ^^^
+LL | #[doc(auto_cfg(hide("a")))]
+   |                     ^^^
+
+error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
+  --> $DIR/doc-cfg.rs:15:21
+   |
+LL | #[doc(auto_cfg(hide(foo::bar)))]
+   |                     ^^^^^^^^
 
 warning: unexpected `cfg` condition name: `foo`
   --> $DIR/doc-cfg.rs:6:11
@@ -42,5 +50,29 @@ LL | #[doc(cfg(foo), cfg(bar))]
    = help: to expect this configuration use `--check-cfg=cfg(bar)`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
 
-error: aborting due to 4 previous errors; 2 warnings emitted
+error: `cfg` predicate is not specified
+  --> $DIR/doc-cfg.rs:3:7
+   |
+LL | #[doc(cfg(), cfg(foo, bar))]
+   |       ^^^^^ help: expected syntax is: `cfg(/* predicate */)`
+
+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:9:7
+   |
+LL | #[doc(cfg())]
+   |       ^^^^^ help: expected syntax is: `cfg(/* predicate */)`
+
+error: multiple `cfg` predicates are specified
+  --> $DIR/doc-cfg.rs:10:16
+   |
+LL | #[doc(cfg(foo, bar))]
+   |                ^^^
+
+error: aborting due to 9 previous errors; 2 warnings emitted
 
diff --git a/tests/rustdoc-ui/feature-gate-doc_cfg.rs b/tests/rustdoc-ui/feature-gate-doc_cfg.rs
new file mode 100644
index 00000000000..b474a1524bc
--- /dev/null
+++ b/tests/rustdoc-ui/feature-gate-doc_cfg.rs
@@ -0,0 +1,6 @@
+#![doc(auto_cfg)] //~ ERROR
+#![doc(auto_cfg(false))] //~ ERROR
+#![doc(auto_cfg(true))] //~ ERROR
+#![doc(auto_cfg(hide(feature = "solecism")))] //~ ERROR
+#![doc(auto_cfg(show(feature = "bla")))] //~ ERROR
+#![doc(cfg(feature = "solecism"))] //~ ERROR
diff --git a/tests/rustdoc-ui/feature-gate-doc_cfg.stderr b/tests/rustdoc-ui/feature-gate-doc_cfg.stderr
new file mode 100644
index 00000000000..68a86c1abb7
--- /dev/null
+++ b/tests/rustdoc-ui/feature-gate-doc_cfg.stderr
@@ -0,0 +1,63 @@
+error[E0658]: `#[doc(auto_cfg)]` is experimental
+  --> $DIR/feature-gate-doc_cfg.rs:1:1
+   |
+LL | #![doc(auto_cfg)]
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
+   = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `#[doc(auto_cfg)]` is experimental
+  --> $DIR/feature-gate-doc_cfg.rs:2:1
+   |
+LL | #![doc(auto_cfg(false))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
+   = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `#[doc(auto_cfg)]` is experimental
+  --> $DIR/feature-gate-doc_cfg.rs:3:1
+   |
+LL | #![doc(auto_cfg(true))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
+   = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `#[doc(auto_cfg)]` is experimental
+  --> $DIR/feature-gate-doc_cfg.rs:4:1
+   |
+LL | #![doc(auto_cfg(hide(feature = "solecism")))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
+   = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `#[doc(auto_cfg)]` is experimental
+  --> $DIR/feature-gate-doc_cfg.rs:5:1
+   |
+LL | #![doc(auto_cfg(show(feature = "bla")))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
+   = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `#[doc(cfg)]` is experimental
+  --> $DIR/feature-gate-doc_cfg.rs:6:1
+   |
+LL | #![doc(cfg(feature = "solecism"))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
+   = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/rustdoc-ui/feature-gate-doc_cfg_hide.rs b/tests/rustdoc-ui/feature-gate-doc_cfg_hide.rs
deleted file mode 100644
index e49285a01b8..00000000000
--- a/tests/rustdoc-ui/feature-gate-doc_cfg_hide.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// FIXME: Remove this file once feature is removed
-
-#![doc(cfg_hide(test))] //~ ERROR
-
-#[cfg(not(test))]
-pub fn public_fn() {}
-#[cfg(test)]
-pub fn internal_use_only() {}
diff --git a/tests/rustdoc-ui/feature-gate-doc_cfg_hide.stderr b/tests/rustdoc-ui/feature-gate-doc_cfg_hide.stderr
deleted file mode 100644
index b3eee2af7f7..00000000000
--- a/tests/rustdoc-ui/feature-gate-doc_cfg_hide.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: unknown `doc` attribute `cfg_hide`
-  --> $DIR/feature-gate-doc_cfg_hide.rs:3:8
-   |
-LL | #![doc(cfg_hide(test))]
-   |        ^^^^^^^^^^^^^^
-   |
-   = note: `#[deny(invalid_doc_attributes)]` on by default
-
-error: aborting due to 1 previous error
-
diff --git a/tests/rustdoc-ui/lints/doc_cfg_hide.stderr b/tests/rustdoc-ui/lints/doc_cfg_hide.stderr
index 9e820a77b5e..c63c8d607fa 100644
--- a/tests/rustdoc-ui/lints/doc_cfg_hide.stderr
+++ b/tests/rustdoc-ui/lints/doc_cfg_hide.stderr
@@ -12,7 +12,7 @@ error: `#![doc(auto_cfg(hide(...)))]` expects a list of items
 LL | #![doc(auto_cfg(hide))]
    |        ^^^^^^^^^^^^^^
 
-error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/values items
+error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
   --> $DIR/doc_cfg_hide.rs:4:22
    |
 LL | #![doc(auto_cfg(hide(not(windows))))]