about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-01-14 11:55:52 -0500
committerJoshua Nelson <jyn514@gmail.com>2021-01-17 15:27:35 -0500
commitfc5359475633fa01adcb1078128de07ad2653ca5 (patch)
tree1c04a76e4f8227bd72e8097457d47dbf466039e5 /src/test
parentedeb631ad0cd6fdf31e2e31ec90e105d1768be28 (diff)
Feature-gate `pointer` and `reference` in intra-doc links
- Only feature gate associated items
- Add docs to unstable book
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs6
-rw-r--r--src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.stderr23
-rw-r--r--src/test/rustdoc-ui/intra-doc/non-path-primitives.rs1
-rw-r--r--src/test/rustdoc-ui/intra-doc/non-path-primitives.stderr18
-rw-r--r--src/test/rustdoc/intra-doc/non-path-primitives.rs1
5 files changed, 40 insertions, 9 deletions
diff --git a/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs b/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs
new file mode 100644
index 00000000000..3cfac942ca8
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs
@@ -0,0 +1,6 @@
+//! [pointer::add]
+//~^ ERROR: experimental
+//! [pointer::wrapping_add]
+//~^ ERROR: experimental
+//! [pointer] // This is explicitly allowed
+//! [reference] // This is explicitly allowed
diff --git a/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.stderr b/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.stderr
new file mode 100644
index 00000000000..2c946ed48db
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.stderr
@@ -0,0 +1,23 @@
+error[E0658]: linking to associated items of raw pointers is experimental
+  --> $DIR/feature-gate-intra-doc-pointers.rs:1:6
+   |
+LL | //! [pointer::add]
+   |      ^^^^^^^^^^^^
+   |
+   = note: see issue #80896 <https://github.com/rust-lang/rust/issues/80896> for more information
+   = help: add `#![feature(intra_doc_pointers)]` to the crate attributes to enable
+   = note: rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does
+
+error[E0658]: linking to associated items of raw pointers is experimental
+  --> $DIR/feature-gate-intra-doc-pointers.rs:3:6
+   |
+LL | //! [pointer::wrapping_add]
+   |      ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #80896 <https://github.com/rust-lang/rust/issues/80896> for more information
+   = help: add `#![feature(intra_doc_pointers)]` to the crate attributes to enable
+   = note: rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/rustdoc-ui/intra-doc/non-path-primitives.rs b/src/test/rustdoc-ui/intra-doc/non-path-primitives.rs
index 114502b0ddf..6785c4c43f5 100644
--- a/src/test/rustdoc-ui/intra-doc/non-path-primitives.rs
+++ b/src/test/rustdoc-ui/intra-doc/non-path-primitives.rs
@@ -1,4 +1,5 @@
 #![deny(broken_intra_doc_links)]
+#![feature(intra_doc_pointers)]
 // These are links that could reasonably expected to work, but don't.
 
 // `[]` isn't supported because it had too many false positives.
diff --git a/src/test/rustdoc-ui/intra-doc/non-path-primitives.stderr b/src/test/rustdoc-ui/intra-doc/non-path-primitives.stderr
index ea831e648f6..174758504ae 100644
--- a/src/test/rustdoc-ui/intra-doc/non-path-primitives.stderr
+++ b/src/test/rustdoc-ui/intra-doc/non-path-primitives.stderr
@@ -1,5 +1,5 @@
 error: unresolved link to `T`
-  --> $DIR/non-path-primitives.rs:11:7
+  --> $DIR/non-path-primitives.rs:12:7
    |
 LL | //! [[T]::rotate_left]
    |       ^ no item named `T` in scope
@@ -12,7 +12,7 @@ LL | #![deny(broken_intra_doc_links)]
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
 
 error: unresolved link to `Z`
-  --> $DIR/non-path-primitives.rs:13:5
+  --> $DIR/non-path-primitives.rs:14:5
    |
 LL | //![Z]([T; N]::map)
    |     ^ no item named `Z` in scope
@@ -20,7 +20,7 @@ LL | //![Z]([T; N]::map)
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
 
 error: unresolved link to `Z`
-  --> $DIR/non-path-primitives.rs:16:6
+  --> $DIR/non-path-primitives.rs:17:6
    |
 LL | //! [Z][]
    |      ^ no item named `Z` in scope
@@ -28,7 +28,7 @@ LL | //! [Z][]
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
 
 error: unresolved link to `Z`
-  --> $DIR/non-path-primitives.rs:18:6
+  --> $DIR/non-path-primitives.rs:19:6
    |
 LL | //! [Z]: [T; N]::map
    |      ^ no item named `Z` in scope
@@ -36,31 +36,31 @@ LL | //! [Z]: [T; N]::map
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
 
 error: unresolved link to `unit::eq`
-  --> $DIR/non-path-primitives.rs:27:6
+  --> $DIR/non-path-primitives.rs:28:6
    |
 LL | //! [unit::eq]
    |      ^^^^^^^^ the builtin type `unit` has no associated item named `eq`
 
 error: unresolved link to `tuple::eq`
-  --> $DIR/non-path-primitives.rs:28:6
+  --> $DIR/non-path-primitives.rs:29:6
    |
 LL | //! [tuple::eq]
    |      ^^^^^^^^^ the builtin type `tuple` has no associated item named `eq`
 
 error: unresolved link to `fn::eq`
-  --> $DIR/non-path-primitives.rs:29:6
+  --> $DIR/non-path-primitives.rs:30:6
    |
 LL | //! [fn::eq]
    |      ^^^^^^ the builtin type `fn` has no associated item named `eq`
 
 error: unresolved link to `never::eq`
-  --> $DIR/non-path-primitives.rs:30:6
+  --> $DIR/non-path-primitives.rs:31:6
    |
 LL | //! [never::eq]
    |      ^^^^^^^^^ the builtin type `never` has no associated item named `eq`
 
 error: unresolved link to `reference::deref`
-  --> $DIR/non-path-primitives.rs:34:6
+  --> $DIR/non-path-primitives.rs:35:6
    |
 LL | //! [reference::deref]
    |      ^^^^^^^^^^^^^^^^ the builtin type `reference` has no associated item named `deref`
diff --git a/src/test/rustdoc/intra-doc/non-path-primitives.rs b/src/test/rustdoc/intra-doc/non-path-primitives.rs
index 2c7e7b5c48c..48c667ef2d1 100644
--- a/src/test/rustdoc/intra-doc/non-path-primitives.rs
+++ b/src/test/rustdoc/intra-doc/non-path-primitives.rs
@@ -1,5 +1,6 @@
 // ignore-tidy-linelength
 #![crate_name = "foo"]
+#![feature(intra_doc_pointers)]
 #![deny(broken_intra_doc_links)]
 
 // @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.rotate_left"]' 'slice::rotate_left'