Skip to content

Commit a0c8a00

Browse files
Add regression tests for intra-doc links
1 parent fcc47d0 commit a0c8a00

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This test ensures that `doc(hidden)` items intra-doc links are checked whereas private
2+
// items are ignored.
3+
4+
//@ compile-flags: -Zunstable-options --document-hidden-items
5+
6+
#![deny(rustdoc::broken_intra_doc_links)]
7+
8+
/// [not::exist]
9+
//~^ ERROR unresolved link to `not::exist`
10+
#[doc(hidden)]
11+
pub struct X;
12+
13+
/// [not::exist]
14+
struct Y;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unresolved link to `not::exist`
2+
--> $DIR/hidden-check.rs:8:6
3+
|
4+
LL | /// [not::exist]
5+
| ^^^^^^^^^^ no item named `not` in scope
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/hidden-check.rs:6:9
9+
|
10+
LL | #![deny(rustdoc::broken_intra_doc_links)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 1 previous error
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This test ensures that private items intra-doc links are checked whereas `doc(hidden)`
2+
// items are ignored.
3+
4+
//@ compile-flags: -Zunstable-options --document-private-items
5+
6+
#![deny(rustdoc::broken_intra_doc_links)]
7+
8+
/// [not::exist]
9+
#[doc(hidden)]
10+
pub struct X;
11+
12+
/// [not::exist]
13+
//~^ ERROR unresolved link to `not::exist`
14+
struct Y;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unresolved link to `not::exist`
2+
--> $DIR/private-check.rs:12:6
3+
|
4+
LL | /// [not::exist]
5+
| ^^^^^^^^^^ no item named `not` in scope
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/private-check.rs:6:9
9+
|
10+
LL | #![deny(rustdoc::broken_intra_doc_links)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 1 previous error
14+

0 commit comments

Comments
 (0)