File tree 5 files changed +90
-0
lines changed
5 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ // This test ensures that ambiguities (not) resolved at a later stage still emit an error.
2
+
3
+ #![ deny( rustdoc:: broken_intra_doc_links) ]
4
+ #![ crate_name = "foo" ]
5
+
6
+ #[ doc( hidden) ]
7
+ pub struct Thing { }
8
+
9
+ #[ allow( non_snake_case) ]
10
+ #[ doc( hidden) ]
11
+ pub fn Thing ( ) { }
12
+
13
+ /// Do stuff with [`Thing`].
14
+ //~^ ERROR all items matching `Thing` are either private or doc(hidden)
15
+ pub fn repro ( _: Thing ) { }
Original file line number Diff line number Diff line change
1
+ error: all items matching `Thing` are either private or doc(hidden)
2
+ --> $DIR/filter-out-private-2.rs:13:21
3
+ |
4
+ LL | /// Do stuff with [`Thing`].
5
+ | ^^^^^ unresolved link
6
+ |
7
+ note: the lint level is defined here
8
+ --> $DIR/filter-out-private-2.rs:3:9
9
+ |
10
+ LL | #![deny(rustdoc::broken_intra_doc_links)]
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
+
13
+ error: aborting due to 1 previous error
14
+
Original file line number Diff line number Diff line change
1
+ // This test ensures that ambiguities resolved at a later stage still emit an error.
2
+
3
+ #![ deny( rustdoc:: broken_intra_doc_links) ]
4
+ #![ crate_name = "foo" ]
5
+
6
+ pub struct Thing { }
7
+
8
+ #[ allow( non_snake_case) ]
9
+ pub fn Thing ( ) { }
10
+
11
+ /// Do stuff with [`Thing`].
12
+ //~^ ERROR `Thing` is both a function and a struct
13
+ pub fn repro ( _: Thing ) { }
Original file line number Diff line number Diff line change
1
+ error: `Thing` is both a function and a struct
2
+ --> $DIR/filter-out-private.rs:11:21
3
+ |
4
+ LL | /// Do stuff with [`Thing`].
5
+ | ^^^^^ ambiguous link
6
+ |
7
+ note: the lint level is defined here
8
+ --> $DIR/filter-out-private.rs:3:9
9
+ |
10
+ LL | #![deny(rustdoc::broken_intra_doc_links)]
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
+ help: to link to the function, add parentheses
13
+ |
14
+ LL | /// Do stuff with [`Thing()`].
15
+ | ++
16
+ help: to link to the struct, prefix with `struct@`
17
+ |
18
+ LL | /// Do stuff with [`struct@Thing`].
19
+ | +++++++
20
+
21
+ error: aborting due to 1 previous error
22
+
Original file line number Diff line number Diff line change
1
+ // This test ensures that private/hidden items don't create ambiguity.
2
+ // This is a regression test for <https://github.com/rust-lang/rust/issues/130233>.
3
+
4
+ #![ deny( rustdoc:: broken_intra_doc_links) ]
5
+ #![ crate_name = "foo" ]
6
+
7
+ pub struct Thing { }
8
+
9
+ #[ doc( hidden) ]
10
+ #[ allow( non_snake_case) ]
11
+ pub fn Thing ( ) { }
12
+
13
+ pub struct Bar { }
14
+
15
+ #[ allow( non_snake_case) ]
16
+ fn Bar ( ) { }
17
+
18
+ //@ has 'foo/fn.repro.html'
19
+ //@ has - '//*[@class="toggle top-doc"]/*[@class="docblock"]//a/@href' 'struct.Thing.html'
20
+ /// Do stuff with [`Thing`].
21
+ pub fn repro ( _: Thing ) { }
22
+
23
+ //@ has 'foo/fn.repro2.html'
24
+ //@ has - '//*[@class="toggle top-doc"]/*[@class="docblock"]//a/@href' 'struct.Bar.html'
25
+ /// Do stuff with [`Bar`].
26
+ pub fn repro2 ( _: Bar ) { }
You can’t perform that action at this time.
0 commit comments