about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-27 04:51:31 +0000
committerbors <bors@rust-lang.org>2019-11-27 04:51:31 +0000
commitb5f265eeed23ac87ec6b4a7e6bc7cb4ea3e67c31 (patch)
tree4eb21ae4fe7ba42f31aa57a5d232e529d6a2b777 /src/test/rustdoc-ui
parent809e180a76ce97340bf4354ff357bc59e3ca40b2 (diff)
parentc1ea1fd2b03b16bfeab01cbcd7bae976ab596923 (diff)
downloadrust-b5f265eeed23ac87ec6b4a7e6bc7cb4ea3e67c31.tar.gz
rust-b5f265eeed23ac87ec6b4a7e6bc7cb4ea3e67c31.zip
Auto merge of #66675 - GuillaumeGomez:support-anchors-intra-doc-links, r=kinnison
Support anchors intra doc links

Fixes #62833
Part of #43466.

cc @ollie27
r? @kinnison
Diffstat (limited to 'src/test/rustdoc-ui')
-rw-r--r--src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr2
-rw-r--r--src/test/rustdoc-ui/intra-doc-alias-ice.stderr2
-rw-r--r--src/test/rustdoc-ui/intra-link-span-ice-55723.rs2
-rw-r--r--src/test/rustdoc-ui/intra-link-span-ice-55723.stderr2
-rw-r--r--src/test/rustdoc-ui/intra-links-anchors.rs45
-rw-r--r--src/test/rustdoc-ui/intra-links-anchors.stderr32
-rw-r--r--src/test/rustdoc-ui/intra-links-warning-crlf.stderr8
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.stderr38
-rw-r--r--src/test/rustdoc-ui/lint-group.stderr2
9 files changed, 105 insertions, 28 deletions
diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
index 1a120dcb186..b432bfbf20f 100644
--- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
+++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
@@ -1,4 +1,4 @@
-error: `[v2]` cannot be resolved, ignoring it...
+error: `[v2]` cannot be resolved, ignoring it.
   --> $DIR/deny-intra-link-resolution-failure.rs:3:6
    |
 LL | /// [v2]
diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
index cebb14cba7c..d4d3e5fea3e 100644
--- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
+++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr
@@ -1,4 +1,4 @@
-error: `[TypeAlias::hoge]` cannot be resolved, ignoring it...
+error: `[TypeAlias::hoge]` cannot be resolved, ignoring it.
   --> $DIR/intra-doc-alias-ice.rs:5:30
    |
 LL | /// [broken cross-reference](TypeAlias::hoge)
diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs
index c7a13bbf606..44997c90f59 100644
--- a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs
+++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs
@@ -7,7 +7,7 @@
 /// ## For example:
 ///
 /// (arr[i])
-//~^ ERROR `[i]` cannot be resolved, ignoring it...
+//~^ ERROR `[i]` cannot be resolved, ignoring it.
 pub fn test_ice() {
     unimplemented!();
 }
diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
index 79702a1a546..edd5b8b92f2 100644
--- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
+++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
@@ -1,4 +1,4 @@
-error: `[i]` cannot be resolved, ignoring it...
+error: `[i]` cannot be resolved, ignoring it.
   --> $DIR/intra-link-span-ice-55723.rs:9:10
    |
 LL | /// (arr[i])
diff --git a/src/test/rustdoc-ui/intra-links-anchors.rs b/src/test/rustdoc-ui/intra-links-anchors.rs
new file mode 100644
index 00000000000..7f8a8dd3c45
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-links-anchors.rs
@@ -0,0 +1,45 @@
+#![deny(intra_doc_link_resolution_failure)]
+
+// 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]` has an issue with the link anchor.
+pub fn foo() {}
+
+/// Empty.
+///
+/// Another anchor error: [hello#people#!].
+//~^ ERROR `[hello#people#!]` has an issue with the link anchor.
+pub fn bar() {}
+
+/// Empty?
+///
+/// Damn enum's variants: [Enum::A#whatever].
+//~^ ERROR `[Enum::A#whatever]` has an issue with the link anchor.
+pub fn enum_link() {}
+
+/// Primitives?
+///
+/// [u32#hello]
+//~^ ERROR `[u32#hello]` has an issue with the link anchor.
+pub fn x() {}
diff --git a/src/test/rustdoc-ui/intra-links-anchors.stderr b/src/test/rustdoc-ui/intra-links-anchors.stderr
new file mode 100644
index 00000000000..5fead8e4c35
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-links-anchors.stderr
@@ -0,0 +1,32 @@
+error: `[Foo::f#hola]` has an issue with the link anchor.
+  --> $DIR/intra-links-anchors.rs:25:15
+   |
+LL | /// Or maybe [Foo::f#hola].
+   |               ^^^^^^^^^^^ struct fields cannot be followed by anchors
+   |
+note: lint level defined here
+  --> $DIR/intra-links-anchors.rs:1:9
+   |
+LL | #![deny(intra_doc_link_resolution_failure)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `[hello#people#!]` has an issue with the link anchor.
+  --> $DIR/intra-links-anchors.rs:31:28
+   |
+LL | /// Another anchor error: [hello#people#!].
+   |                            ^^^^^^^^^^^^^^ only one `#` is allowed in a link
+
+error: `[Enum::A#whatever]` has an issue with the link anchor.
+  --> $DIR/intra-links-anchors.rs:37:28
+   |
+LL | /// Damn enum's variants: [Enum::A#whatever].
+   |                            ^^^^^^^^^^^^^^^^ variants cannot be followed by anchors
+
+error: `[u32#hello]` has an issue with the link anchor.
+  --> $DIR/intra-links-anchors.rs:43:6
+   |
+LL | /// [u32#hello]
+   |      ^^^^^^^^^ primitive types cannot be followed by anchors
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
index b4e11c29ed5..e4dd13cfa01 100644
--- a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
@@ -1,4 +1,4 @@
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning-crlf.rs:7:6
    |
 LL | /// [error]
@@ -7,7 +7,7 @@ LL | /// [error]
    = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error1]` cannot be resolved, ignoring it...
+warning: `[error1]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning-crlf.rs:12:11
    |
 LL | /// docs [error1]
@@ -15,7 +15,7 @@ LL | /// docs [error1]
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error2]` cannot be resolved, ignoring it...
+warning: `[error2]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning-crlf.rs:15:11
    |
 LL | /// docs [error2]
@@ -23,7 +23,7 @@ LL | /// docs [error2]
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning-crlf.rs:23:20
    |
 LL |  * It also has an [error].
diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr
index 27cc3aeb081..5f1c9cfbc36 100644
--- a/src/test/rustdoc-ui/intra-links-warning.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning.stderr
@@ -1,4 +1,4 @@
-warning: `[Foo::baz]` cannot be resolved, ignoring it...
+warning: `[Foo::baz]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:3:23
    |
 LL |        //! Test with [Foo::baz], [Bar::foo], ...
@@ -7,7 +7,7 @@ LL |        //! Test with [Foo::baz], [Bar::foo], ...
    = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[Bar::foo]` cannot be resolved, ignoring it...
+warning: `[Bar::foo]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:3:35
    |
 LL |        //! Test with [Foo::baz], [Bar::foo], ...
@@ -15,7 +15,7 @@ LL |        //! Test with [Foo::baz], [Bar::foo], ...
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[Uniooon::X]` cannot be resolved, ignoring it...
+warning: `[Uniooon::X]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:6:13
    |
 LL |      //! , [Uniooon::X] and [Qux::Z].
@@ -23,7 +23,7 @@ LL |      //! , [Uniooon::X] and [Qux::Z].
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[Qux::Z]` cannot be resolved, ignoring it...
+warning: `[Qux::Z]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:6:30
    |
 LL |      //! , [Uniooon::X] and [Qux::Z].
@@ -31,7 +31,7 @@ LL |      //! , [Uniooon::X] and [Qux::Z].
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[Uniooon::X]` cannot be resolved, ignoring it...
+warning: `[Uniooon::X]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:10:14
    |
 LL |       //! , [Uniooon::X] and [Qux::Z].
@@ -39,7 +39,7 @@ LL |       //! , [Uniooon::X] and [Qux::Z].
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[Qux::Z]` cannot be resolved, ignoring it...
+warning: `[Qux::Z]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:10:31
    |
 LL |       //! , [Uniooon::X] and [Qux::Z].
@@ -47,7 +47,7 @@ LL |       //! , [Uniooon::X] and [Qux::Z].
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[Qux:Y]` cannot be resolved, ignoring it...
+warning: `[Qux:Y]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:14:13
    |
 LL |        /// [Qux:Y]
@@ -55,7 +55,7 @@ LL |        /// [Qux:Y]
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:58:30
    |
 LL |  * time to introduce a link [error]*/
@@ -63,7 +63,7 @@ LL |  * time to introduce a link [error]*/
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:64:30
    |
 LL |  * time to introduce a link [error]
@@ -71,7 +71,7 @@ LL |  * time to introduce a link [error]
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:68:1
    |
 LL | #[doc = "single line [error]"]
@@ -83,7 +83,7 @@ LL | #[doc = "single line [error]"]
                         ^^^^^
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:71:1
    |
 LL | #[doc = "single line with \"escaping\" [error]"]
@@ -95,7 +95,7 @@ LL | #[doc = "single line with \"escaping\" [error]"]
                                         ^^^^^
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error]` cannot be resolved, ignoring it...
+warning: `[error]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:74:1
    |
 LL | / /// Item docs.
@@ -109,7 +109,7 @@ LL | | /// [error]
             ^^^^^
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error1]` cannot be resolved, ignoring it...
+warning: `[error1]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:80:11
    |
 LL | /// docs [error1]
@@ -117,7 +117,7 @@ LL | /// docs [error1]
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[error2]` cannot be resolved, ignoring it...
+warning: `[error2]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:82:11
    |
 LL | /// docs [error2]
@@ -125,7 +125,7 @@ LL | /// docs [error2]
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[BarA]` cannot be resolved, ignoring it...
+warning: `[BarA]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:21:10
    |
 LL | /// bar [BarA] bar
@@ -133,7 +133,7 @@ LL | /// bar [BarA] bar
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[BarB]` cannot be resolved, ignoring it...
+warning: `[BarB]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:27:9
    |
 LL |  * bar [BarB] bar
@@ -141,7 +141,7 @@ LL |  * bar [BarB] bar
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[BarC]` cannot be resolved, ignoring it...
+warning: `[BarC]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:34:6
    |
 LL | bar [BarC] bar
@@ -149,7 +149,7 @@ LL | bar [BarC] bar
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[BarD]` cannot be resolved, ignoring it...
+warning: `[BarD]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:45:1
    |
 LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
@@ -161,7 +161,7 @@ LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
                 ^^^^
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
-warning: `[BarF]` cannot be resolved, ignoring it...
+warning: `[BarF]` cannot be resolved, ignoring it.
   --> $DIR/intra-links-warning.rs:50:9
    |
 LL |         #[doc = $f]
diff --git a/src/test/rustdoc-ui/lint-group.stderr b/src/test/rustdoc-ui/lint-group.stderr
index 63274ae2be4..dca98cf58df 100644
--- a/src/test/rustdoc-ui/lint-group.stderr
+++ b/src/test/rustdoc-ui/lint-group.stderr
@@ -15,7 +15,7 @@ LL | #![deny(rustdoc)]
    |         ^^^^^^^
    = note: `#[deny(private_doc_tests)]` implied by `#[deny(rustdoc)]`
 
-error: `[error]` cannot be resolved, ignoring it...
+error: `[error]` cannot be resolved, ignoring it.
   --> $DIR/lint-group.rs:9:29
    |
 LL | /// what up, let's make an [error]