about summary refs log tree commit diff
path: root/src/test/rustdoc-ui/intra-doc/anchors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/rustdoc-ui/intra-doc/anchors.rs')
-rw-r--r--src/test/rustdoc-ui/intra-doc/anchors.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/intra-doc/anchors.rs b/src/test/rustdoc-ui/intra-doc/anchors.rs
new file mode 100644
index 00000000000..ccefd2e6fab
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-doc/anchors.rs
@@ -0,0 +1,45 @@
+#![deny(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() {}
+
+/// Primitives?
+///
+/// [u32#hello]
+//~^ ERROR `u32#hello` contains an anchor
+pub fn x() {}