summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/intra-doc/anchors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-ui/intra-doc/anchors.rs')
-rw-r--r--tests/rustdoc-ui/intra-doc/anchors.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/intra-doc/anchors.rs b/tests/rustdoc-ui/intra-doc/anchors.rs
new file mode 100644
index 000000000..34e11c7c7
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/anchors.rs
@@ -0,0 +1,39 @@
+#![deny(rustdoc::broken_intra_doc_links)]
+
+// A few tests on anchors.
+
+/// Hello people.
+///
+/// You can anchors? Here's one!
+///
+/// # hola
+///
+/// Isn't it amazing?
+pub struct Foo {
+ pub f: u8,
+}
+
+pub enum Enum {
+ A,
+ B,
+}
+
+/// Have you heard about stuff?
+///
+/// Like [Foo#hola].
+///
+/// Or maybe [Foo::f#hola].
+//~^ ERROR `Foo::f#hola` contains an anchor
+pub fn foo() {}
+
+/// Empty.
+///
+/// Another anchor error: [hello#people#!].
+//~^ ERROR `hello#people#!` contains multiple anchors
+pub fn bar() {}
+
+/// Empty?
+///
+/// Damn enum's variants: [Enum::A#whatever].
+//~^ ERROR `Enum::A#whatever` contains an anchor
+pub fn enum_link() {}