summaryrefslogtreecommitdiffstats
path: root/tests/ui/rustdoc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rustdoc')
-rw-r--r--tests/ui/rustdoc/README.md3
-rw-r--r--tests/ui/rustdoc/cfg-rustdoc.rs6
-rw-r--r--tests/ui/rustdoc/cfg-rustdoc.stderr9
-rw-r--r--tests/ui/rustdoc/check-doc-alias-attr-location.rs32
-rw-r--r--tests/ui/rustdoc/check-doc-alias-attr-location.stderr50
-rw-r--r--tests/ui/rustdoc/check-doc-alias-attr.rs28
-rw-r--r--tests/ui/rustdoc/check-doc-alias-attr.stderr108
-rw-r--r--tests/ui/rustdoc/deny-invalid-doc-attrs.rs7
-rw-r--r--tests/ui/rustdoc/deny-invalid-doc-attrs.stderr16
-rw-r--r--tests/ui/rustdoc/doc-alias-crate-level.rs8
-rw-r--r--tests/ui/rustdoc/doc-alias-crate-level.stderr14
-rw-r--r--tests/ui/rustdoc/doc-alias-same-name.rs4
-rw-r--r--tests/ui/rustdoc/doc-alias-same-name.stderr8
-rw-r--r--tests/ui/rustdoc/doc-inline-extern-crate.rs9
-rw-r--r--tests/ui/rustdoc/doc-inline-extern-crate.stderr13
-rw-r--r--tests/ui/rustdoc/doc-test-attr-pass.rs9
-rw-r--r--tests/ui/rustdoc/doc-test-attr.rs14
-rw-r--r--tests/ui/rustdoc/doc-test-attr.stderr34
-rw-r--r--tests/ui/rustdoc/doc_keyword.rs20
-rw-r--r--tests/ui/rustdoc/doc_keyword.stderr26
-rw-r--r--tests/ui/rustdoc/duplicate_doc_alias.rs9
-rw-r--r--tests/ui/rustdoc/duplicate_doc_alias.stderr24
-rw-r--r--tests/ui/rustdoc/feature-gate-doc_primitive.rs8
-rw-r--r--tests/ui/rustdoc/feature-gate-doc_primitive.stderr12
-rw-r--r--tests/ui/rustdoc/hidden-doc-associated-item.rs15
-rw-r--r--tests/ui/rustdoc/renamed-features-rustdoc_internals.rs5
-rw-r--r--tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr19
-rw-r--r--tests/ui/rustdoc/unterminated-doc-comment.rs1
-rw-r--r--tests/ui/rustdoc/unterminated-doc-comment.stderr9
29 files changed, 520 insertions, 0 deletions
diff --git a/tests/ui/rustdoc/README.md b/tests/ui/rustdoc/README.md
new file mode 100644
index 000000000..1c98ab038
--- /dev/null
+++ b/tests/ui/rustdoc/README.md
@@ -0,0 +1,3 @@
+This directory is for tests that have to do with rustdoc, but test the behavior
+of rustc. For example, rustc should not warn that an attribute rustdoc uses is
+unknown.
diff --git a/tests/ui/rustdoc/cfg-rustdoc.rs b/tests/ui/rustdoc/cfg-rustdoc.rs
new file mode 100644
index 000000000..dd8e1ed97
--- /dev/null
+++ b/tests/ui/rustdoc/cfg-rustdoc.rs
@@ -0,0 +1,6 @@
+#[cfg(doc)]
+pub struct Foo;
+
+fn main() {
+ let f = Foo; //~ ERROR
+}
diff --git a/tests/ui/rustdoc/cfg-rustdoc.stderr b/tests/ui/rustdoc/cfg-rustdoc.stderr
new file mode 100644
index 000000000..c687d1869
--- /dev/null
+++ b/tests/ui/rustdoc/cfg-rustdoc.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `Foo` in this scope
+ --> $DIR/cfg-rustdoc.rs:5:13
+ |
+LL | let f = Foo;
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/rustdoc/check-doc-alias-attr-location.rs b/tests/ui/rustdoc/check-doc-alias-attr-location.rs
new file mode 100644
index 000000000..10609e5d8
--- /dev/null
+++ b/tests/ui/rustdoc/check-doc-alias-attr-location.rs
@@ -0,0 +1,32 @@
+#![crate_type = "lib"]
+
+pub struct Bar;
+pub trait Foo {
+ type X;
+ fn foo(x: u32) -> Self::X;
+}
+
+#[doc(alias = "foo")] //~ ERROR
+extern "C" {}
+
+#[doc(alias = "bar")] //~ ERROR
+impl Bar {
+ #[doc(alias = "const")]
+ const A: u32 = 0;
+}
+
+#[doc(alias = "foobar")] //~ ERROR
+impl Foo for Bar {
+ #[doc(alias = "assoc")] //~ ERROR
+ type X = i32;
+ fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X {
+ //~^ ERROR
+ #[doc(alias = "stmt")] //~ ERROR
+ let x = 0;
+ #[doc(alias = "expr")] //~ ERROR
+ match x {
+ #[doc(alias = "arm")] //~ ERROR
+ _ => 0
+ }
+ }
+}
diff --git a/tests/ui/rustdoc/check-doc-alias-attr-location.stderr b/tests/ui/rustdoc/check-doc-alias-attr-location.stderr
new file mode 100644
index 000000000..23c93a4ed
--- /dev/null
+++ b/tests/ui/rustdoc/check-doc-alias-attr-location.stderr
@@ -0,0 +1,50 @@
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+ --> $DIR/check-doc-alias-attr-location.rs:22:12
+ |
+LL | fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on foreign module
+ --> $DIR/check-doc-alias-attr-location.rs:9:7
+ |
+LL | #[doc(alias = "foo")]
+ | ^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on implementation block
+ --> $DIR/check-doc-alias-attr-location.rs:12:7
+ |
+LL | #[doc(alias = "bar")]
+ | ^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on implementation block
+ --> $DIR/check-doc-alias-attr-location.rs:18:7
+ |
+LL | #[doc(alias = "foobar")]
+ | ^^^^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation block
+ --> $DIR/check-doc-alias-attr-location.rs:20:11
+ |
+LL | #[doc(alias = "assoc")]
+ | ^^^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on statement
+ --> $DIR/check-doc-alias-attr-location.rs:24:15
+ |
+LL | #[doc(alias = "stmt")]
+ | ^^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on expression
+ --> $DIR/check-doc-alias-attr-location.rs:26:15
+ |
+LL | #[doc(alias = "expr")]
+ | ^^^^^^^^^^^^^^
+
+error: `#[doc(alias = "...")]` isn't allowed on match arm
+ --> $DIR/check-doc-alias-attr-location.rs:28:19
+ |
+LL | #[doc(alias = "arm")]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/rustdoc/check-doc-alias-attr.rs b/tests/ui/rustdoc/check-doc-alias-attr.rs
new file mode 100644
index 000000000..719b98604
--- /dev/null
+++ b/tests/ui/rustdoc/check-doc-alias-attr.rs
@@ -0,0 +1,28 @@
+#![crate_type = "lib"]
+
+#[doc(alias = "foo")] // ok!
+#[doc(alias("bar", "baz"))] // ok!
+pub struct Bar;
+
+#[doc(alias)] //~ ERROR
+#[doc(alias = 0)] //~ ERROR
+#[doc(alias = "\"")] //~ ERROR
+#[doc(alias = "\n")] //~ ERROR
+#[doc(alias = "
+")] //~^ ERROR
+#[doc(alias = "\t")] //~ ERROR
+#[doc(alias = " hello")] //~ ERROR
+#[doc(alias = "hello ")] //~ ERROR
+#[doc(alias = "")] //~ ERROR
+pub struct Foo;
+
+#[doc(alias(0))] //~ ERROR
+#[doc(alias("\""))] //~ ERROR
+#[doc(alias("\n"))] //~ ERROR
+#[doc(alias("
+"))] //~^ ERROR
+#[doc(alias("\t"))] //~ ERROR
+#[doc(alias(" hello"))] //~ ERROR
+#[doc(alias("hello "))] //~ ERROR
+#[doc(alias(""))] //~ ERROR
+pub struct Foo2;
diff --git a/tests/ui/rustdoc/check-doc-alias-attr.stderr b/tests/ui/rustdoc/check-doc-alias-attr.stderr
new file mode 100644
index 000000000..250568be3
--- /dev/null
+++ b/tests/ui/rustdoc/check-doc-alias-attr.stderr
@@ -0,0 +1,108 @@
+error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
+ --> $DIR/check-doc-alias-attr.rs:7:7
+ |
+LL | #[doc(alias)]
+ | ^^^^^
+
+error: doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]`
+ --> $DIR/check-doc-alias-attr.rs:8:7
+ |
+LL | #[doc(alias = 0)]
+ | ^^^^^^^^^
+
+error: '"' character isn't allowed in `#[doc(alias = "...")]`
+ --> $DIR/check-doc-alias-attr.rs:9:15
+ |
+LL | #[doc(alias = "\"")]
+ | ^^^^
+
+error: '\n' character isn't allowed in `#[doc(alias = "...")]`
+ --> $DIR/check-doc-alias-attr.rs:10:15
+ |
+LL | #[doc(alias = "\n")]
+ | ^^^^
+
+error: '\n' character isn't allowed in `#[doc(alias = "...")]`
+ --> $DIR/check-doc-alias-attr.rs:11:15
+ |
+LL | #[doc(alias = "
+ | _______________^
+LL | | ")]
+ | |_^
+
+error: '\t' character isn't allowed in `#[doc(alias = "...")]`
+ --> $DIR/check-doc-alias-attr.rs:13:15
+ |
+LL | #[doc(alias = "\t")]
+ | ^^^^
+
+error: `#[doc(alias = "...")]` cannot start or end with ' '
+ --> $DIR/check-doc-alias-attr.rs:14:15
+ |
+LL | #[doc(alias = " hello")]
+ | ^^^^^^^^
+
+error: `#[doc(alias = "...")]` cannot start or end with ' '
+ --> $DIR/check-doc-alias-attr.rs:15:15
+ |
+LL | #[doc(alias = "hello ")]
+ | ^^^^^^^^
+
+error: `#[doc(alias = "...")]` attribute cannot have empty value
+ --> $DIR/check-doc-alias-attr.rs:16:15
+ |
+LL | #[doc(alias = "")]
+ | ^^
+
+error: `#[doc(alias("a"))]` expects string literals
+ --> $DIR/check-doc-alias-attr.rs:19:13
+ |
+LL | #[doc(alias(0))]
+ | ^
+
+error: '"' character isn't allowed in `#[doc(alias("..."))]`
+ --> $DIR/check-doc-alias-attr.rs:20:13
+ |
+LL | #[doc(alias("\""))]
+ | ^^^^
+
+error: '\n' character isn't allowed in `#[doc(alias("..."))]`
+ --> $DIR/check-doc-alias-attr.rs:21:13
+ |
+LL | #[doc(alias("\n"))]
+ | ^^^^
+
+error: '\n' character isn't allowed in `#[doc(alias("..."))]`
+ --> $DIR/check-doc-alias-attr.rs:22:13
+ |
+LL | #[doc(alias("
+ | _____________^
+LL | | "))]
+ | |_^
+
+error: '\t' character isn't allowed in `#[doc(alias("..."))]`
+ --> $DIR/check-doc-alias-attr.rs:24:13
+ |
+LL | #[doc(alias("\t"))]
+ | ^^^^
+
+error: `#[doc(alias("..."))]` cannot start or end with ' '
+ --> $DIR/check-doc-alias-attr.rs:25:13
+ |
+LL | #[doc(alias(" hello"))]
+ | ^^^^^^^^
+
+error: `#[doc(alias("..."))]` cannot start or end with ' '
+ --> $DIR/check-doc-alias-attr.rs:26:13
+ |
+LL | #[doc(alias("hello "))]
+ | ^^^^^^^^
+
+error: `#[doc(alias("..."))]` attribute cannot have empty value
+ --> $DIR/check-doc-alias-attr.rs:27:13
+ |
+LL | #[doc(alias(""))]
+ | ^^
+
+error: aborting due to 17 previous errors
+
diff --git a/tests/ui/rustdoc/deny-invalid-doc-attrs.rs b/tests/ui/rustdoc/deny-invalid-doc-attrs.rs
new file mode 100644
index 000000000..02e9c6791
--- /dev/null
+++ b/tests/ui/rustdoc/deny-invalid-doc-attrs.rs
@@ -0,0 +1,7 @@
+#![deny(invalid_doc_attributes)]
+//~^ NOTE defined here
+#![doc(x)]
+//~^ ERROR unknown `doc` attribute `x`
+//~| WARNING will become a hard error
+//~| NOTE see issue #82730
+fn main() {}
diff --git a/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr b/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr
new file mode 100644
index 000000000..e9a4c1dd5
--- /dev/null
+++ b/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr
@@ -0,0 +1,16 @@
+error: unknown `doc` attribute `x`
+ --> $DIR/deny-invalid-doc-attrs.rs:3:8
+ |
+LL | #![doc(x)]
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
+note: the lint level is defined here
+ --> $DIR/deny-invalid-doc-attrs.rs:1:9
+ |
+LL | #![deny(invalid_doc_attributes)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rustdoc/doc-alias-crate-level.rs b/tests/ui/rustdoc/doc-alias-crate-level.rs
new file mode 100644
index 000000000..c7783aae5
--- /dev/null
+++ b/tests/ui/rustdoc/doc-alias-crate-level.rs
@@ -0,0 +1,8 @@
+// compile-flags: -Zdeduplicate-diagnostics=no
+
+#![crate_type = "lib"]
+
+#![doc(alias = "not working!")] //~ ERROR
+
+#[doc(alias = "shouldn't work!")] //~ ERROR
+pub struct Foo;
diff --git a/tests/ui/rustdoc/doc-alias-crate-level.stderr b/tests/ui/rustdoc/doc-alias-crate-level.stderr
new file mode 100644
index 000000000..bd32609ad
--- /dev/null
+++ b/tests/ui/rustdoc/doc-alias-crate-level.stderr
@@ -0,0 +1,14 @@
+error: '\'' character isn't allowed in `#[doc(alias = "...")]`
+ --> $DIR/doc-alias-crate-level.rs:7:15
+ |
+LL | #[doc(alias = "shouldn't work!")]
+ | ^^^^^^^^^^^^^^^^^
+
+error: `#![doc(alias = "...")]` isn't allowed as a crate-level attribute
+ --> $DIR/doc-alias-crate-level.rs:5:8
+ |
+LL | #![doc(alias = "not working!")]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rustdoc/doc-alias-same-name.rs b/tests/ui/rustdoc/doc-alias-same-name.rs
new file mode 100644
index 000000000..da97c2676
--- /dev/null
+++ b/tests/ui/rustdoc/doc-alias-same-name.rs
@@ -0,0 +1,4 @@
+#![crate_type = "lib"]
+
+#[doc(alias = "Foo")] //~ ERROR
+pub struct Foo;
diff --git a/tests/ui/rustdoc/doc-alias-same-name.stderr b/tests/ui/rustdoc/doc-alias-same-name.stderr
new file mode 100644
index 000000000..5ba09a2ea
--- /dev/null
+++ b/tests/ui/rustdoc/doc-alias-same-name.stderr
@@ -0,0 +1,8 @@
+error: `#[doc(alias = "...")]` is the same as the item's name
+ --> $DIR/doc-alias-same-name.rs:3:7
+ |
+LL | #[doc(alias = "Foo")]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rustdoc/doc-inline-extern-crate.rs b/tests/ui/rustdoc/doc-inline-extern-crate.rs
new file mode 100644
index 000000000..0eb4c1490
--- /dev/null
+++ b/tests/ui/rustdoc/doc-inline-extern-crate.rs
@@ -0,0 +1,9 @@
+#[doc(inline)]
+//~^ ERROR conflicting
+#[doc(no_inline)]
+pub extern crate core;
+
+// no warning
+pub extern crate alloc;
+
+fn main() {}
diff --git a/tests/ui/rustdoc/doc-inline-extern-crate.stderr b/tests/ui/rustdoc/doc-inline-extern-crate.stderr
new file mode 100644
index 000000000..41518295b
--- /dev/null
+++ b/tests/ui/rustdoc/doc-inline-extern-crate.stderr
@@ -0,0 +1,13 @@
+error: conflicting doc inlining attributes
+ --> $DIR/doc-inline-extern-crate.rs:1:7
+ |
+LL | #[doc(inline)]
+ | ^^^^^^ this attribute...
+LL |
+LL | #[doc(no_inline)]
+ | ^^^^^^^^^ ...conflicts with this attribute
+ |
+ = help: remove one of the conflicting attributes
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rustdoc/doc-test-attr-pass.rs b/tests/ui/rustdoc/doc-test-attr-pass.rs
new file mode 100644
index 000000000..7884addd1
--- /dev/null
+++ b/tests/ui/rustdoc/doc-test-attr-pass.rs
@@ -0,0 +1,9 @@
+// check-pass
+
+#![crate_type = "lib"]
+#![deny(invalid_doc_attributes)]
+#![doc(test(no_crate_inject))]
+#![doc(test(attr(deny(warnings))))]
+#![doc(test())]
+
+pub fn foo() {}
diff --git a/tests/ui/rustdoc/doc-test-attr.rs b/tests/ui/rustdoc/doc-test-attr.rs
new file mode 100644
index 000000000..46178ad86
--- /dev/null
+++ b/tests/ui/rustdoc/doc-test-attr.rs
@@ -0,0 +1,14 @@
+#![crate_type = "lib"]
+#![deny(invalid_doc_attributes)]
+
+#![doc(test)]
+//~^ ERROR `#[doc(test(...)]` takes a list of attributes
+//~^^ WARN this was previously accepted by the compiler
+#![doc(test = "hello")]
+//~^ ERROR `#[doc(test(...)]` takes a list of attributes
+//~^^ WARN this was previously accepted by the compiler
+#![doc(test(a))]
+//~^ ERROR unknown `doc(test)` attribute `a`
+//~^^ WARN this was previously accepted by the compiler
+
+pub fn foo() {}
diff --git a/tests/ui/rustdoc/doc-test-attr.stderr b/tests/ui/rustdoc/doc-test-attr.stderr
new file mode 100644
index 000000000..5e6014954
--- /dev/null
+++ b/tests/ui/rustdoc/doc-test-attr.stderr
@@ -0,0 +1,34 @@
+error: `#[doc(test(...)]` takes a list of attributes
+ --> $DIR/doc-test-attr.rs:4:8
+ |
+LL | #![doc(test)]
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
+note: the lint level is defined here
+ --> $DIR/doc-test-attr.rs:2:9
+ |
+LL | #![deny(invalid_doc_attributes)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: `#[doc(test(...)]` takes a list of attributes
+ --> $DIR/doc-test-attr.rs:7:8
+ |
+LL | #![doc(test = "hello")]
+ | ^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
+
+error: unknown `doc(test)` attribute `a`
+ --> $DIR/doc-test-attr.rs:10:13
+ |
+LL | #![doc(test(a))]
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/rustdoc/doc_keyword.rs b/tests/ui/rustdoc/doc_keyword.rs
new file mode 100644
index 000000000..68a8802b2
--- /dev/null
+++ b/tests/ui/rustdoc/doc_keyword.rs
@@ -0,0 +1,20 @@
+#![crate_type = "lib"]
+#![feature(rustdoc_internals)]
+
+#![doc(keyword = "hello")] //~ ERROR
+
+#[doc(keyword = "hell")] //~ ERROR
+mod foo {
+ fn hell() {}
+}
+
+#[doc(keyword = "hall")] //~ ERROR
+fn foo() {}
+
+
+// Regression test for the ICE described in #83512.
+trait Foo {
+ #[doc(keyword = "match")]
+ //~^ ERROR: `#[doc(keyword = "...")]` should be used on modules
+ fn quux() {}
+}
diff --git a/tests/ui/rustdoc/doc_keyword.stderr b/tests/ui/rustdoc/doc_keyword.stderr
new file mode 100644
index 000000000..a1d0e4ffc
--- /dev/null
+++ b/tests/ui/rustdoc/doc_keyword.stderr
@@ -0,0 +1,26 @@
+error: `#[doc(keyword = "...")]` should be used on empty modules
+ --> $DIR/doc_keyword.rs:6:7
+ |
+LL | #[doc(keyword = "hell")]
+ | ^^^^^^^^^^^^^^^^
+
+error: `#[doc(keyword = "...")]` should be used on modules
+ --> $DIR/doc_keyword.rs:11:7
+ |
+LL | #[doc(keyword = "hall")]
+ | ^^^^^^^^^^^^^^^^
+
+error: `#[doc(keyword = "...")]` should be used on modules
+ --> $DIR/doc_keyword.rs:17:11
+ |
+LL | #[doc(keyword = "match")]
+ | ^^^^^^^^^^^^^^^^^
+
+error: `#![doc(keyword = "...")]` isn't allowed as a crate-level attribute
+ --> $DIR/doc_keyword.rs:4:8
+ |
+LL | #![doc(keyword = "hello")]
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/rustdoc/duplicate_doc_alias.rs b/tests/ui/rustdoc/duplicate_doc_alias.rs
new file mode 100644
index 000000000..a564ab645
--- /dev/null
+++ b/tests/ui/rustdoc/duplicate_doc_alias.rs
@@ -0,0 +1,9 @@
+#![deny(unused_attributes)]
+
+#[doc(alias = "A")]
+#[doc(alias = "A")] //~ ERROR
+#[doc(alias = "B")]
+#[doc(alias("B"))] //~ ERROR
+pub struct Foo;
+
+fn main() {}
diff --git a/tests/ui/rustdoc/duplicate_doc_alias.stderr b/tests/ui/rustdoc/duplicate_doc_alias.stderr
new file mode 100644
index 000000000..4b2dd1f8e
--- /dev/null
+++ b/tests/ui/rustdoc/duplicate_doc_alias.stderr
@@ -0,0 +1,24 @@
+error: doc alias is duplicated
+ --> $DIR/duplicate_doc_alias.rs:4:7
+ |
+LL | #[doc(alias = "A")]
+ | ----------- first defined here
+LL | #[doc(alias = "A")]
+ | ^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/duplicate_doc_alias.rs:1:9
+ |
+LL | #![deny(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: doc alias is duplicated
+ --> $DIR/duplicate_doc_alias.rs:6:13
+ |
+LL | #[doc(alias = "B")]
+ | ----------- first defined here
+LL | #[doc(alias("B"))]
+ | ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rustdoc/feature-gate-doc_primitive.rs b/tests/ui/rustdoc/feature-gate-doc_primitive.rs
new file mode 100644
index 000000000..18e99e72f
--- /dev/null
+++ b/tests/ui/rustdoc/feature-gate-doc_primitive.rs
@@ -0,0 +1,8 @@
+// check-pass
+#[doc(primitive = "usize")]
+//~^ WARNING `doc(primitive)` should never have been stable
+//~| WARNING hard error in a future release
+/// Some docs
+mod usize {}
+
+fn main() {}
diff --git a/tests/ui/rustdoc/feature-gate-doc_primitive.stderr b/tests/ui/rustdoc/feature-gate-doc_primitive.stderr
new file mode 100644
index 000000000..194b2d87d
--- /dev/null
+++ b/tests/ui/rustdoc/feature-gate-doc_primitive.stderr
@@ -0,0 +1,12 @@
+warning: `doc(primitive)` should never have been stable
+ --> $DIR/feature-gate-doc_primitive.rs:2:7
+ |
+LL | #[doc(primitive = "usize")]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
+ = note: `#[warn(invalid_doc_attributes)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/rustdoc/hidden-doc-associated-item.rs b/tests/ui/rustdoc/hidden-doc-associated-item.rs
new file mode 100644
index 000000000..d431f9e89
--- /dev/null
+++ b/tests/ui/rustdoc/hidden-doc-associated-item.rs
@@ -0,0 +1,15 @@
+// check-pass
+// See issue #85526.
+// This test should produce no warnings.
+
+#![deny(missing_docs)]
+//! Crate docs
+
+#[doc(hidden)]
+pub struct Foo;
+
+impl Foo {
+ pub fn bar() {}
+}
+
+fn main() {}
diff --git a/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs b/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs
new file mode 100644
index 000000000..739c624d0
--- /dev/null
+++ b/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs
@@ -0,0 +1,5 @@
+#![feature(doc_keyword)] //~ ERROR
+#![feature(doc_primitive)] //~ ERROR
+#![crate_type = "lib"]
+
+pub fn foo() {}
diff --git a/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr b/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr
new file mode 100644
index 000000000..d0979ce97
--- /dev/null
+++ b/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr
@@ -0,0 +1,19 @@
+error[E0557]: feature has been removed
+ --> $DIR/renamed-features-rustdoc_internals.rs:1:12
+ |
+LL | #![feature(doc_keyword)]
+ | ^^^^^^^^^^^ feature has been removed
+ |
+ = note: merged into `#![feature(rustdoc_internals)]`
+
+error[E0557]: feature has been removed
+ --> $DIR/renamed-features-rustdoc_internals.rs:2:12
+ |
+LL | #![feature(doc_primitive)]
+ | ^^^^^^^^^^^^^ feature has been removed
+ |
+ = note: merged into `#![feature(rustdoc_internals)]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0557`.
diff --git a/tests/ui/rustdoc/unterminated-doc-comment.rs b/tests/ui/rustdoc/unterminated-doc-comment.rs
new file mode 100644
index 000000000..82546fe73
--- /dev/null
+++ b/tests/ui/rustdoc/unterminated-doc-comment.rs
@@ -0,0 +1 @@
+/*! //~ ERROR E0758
diff --git a/tests/ui/rustdoc/unterminated-doc-comment.stderr b/tests/ui/rustdoc/unterminated-doc-comment.stderr
new file mode 100644
index 000000000..2d5e53797
--- /dev/null
+++ b/tests/ui/rustdoc/unterminated-doc-comment.stderr
@@ -0,0 +1,9 @@
+error[E0758]: unterminated block doc-comment
+ --> $DIR/unterminated-doc-comment.rs:1:1
+ |
+LL | /*!
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0758`.