Skip to content

Commit 0f7f85e

Browse files
Update rustdoc-ui tests for intra-doc links errors
1 parent a2f3e4a commit 0f7f85e

10 files changed

+166
-92
lines changed

src/test/rustdoc-ui/assoc-item-not-in-scope.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: unresolved link to `S::fmt`
2-
--> $DIR/assoc-item-not-in-scope.rs:4:14
2+
--> $DIR/assoc-item-not-in-scope.rs:4:15
33
|
44
LL | /// Link to [`S::fmt`]
5-
| ^^^^^^^^ the struct `S` has no field or associated item named `fmt`
5+
| ^^^^^^ the struct `S` has no field or associated item named `fmt`
66
|
77
note: the lint level is defined here
88
--> $DIR/assoc-item-not-in-scope.rs:1:9

src/test/rustdoc-ui/intra-doc/ambiguity.stderr

+19-19
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
1212
help: to link to the module, prefix with `mod@`
1313
|
1414
LL | /// [mod@true]
15-
| ^^^^^^^^
15+
| ^^^^
1616
help: to link to the builtin type, prefix with `prim@`
1717
|
1818
LL | /// [prim@true]
19-
| ^^^^^^^^^
19+
| ^^^^^
2020

2121
error: `ambiguous` is both a struct and a function
22-
--> $DIR/ambiguity.rs:27:6
22+
--> $DIR/ambiguity.rs:27:7
2323
|
2424
LL | /// [`ambiguous`] is ambiguous.
25-
| ^^^^^^^^^^^ ambiguous link
25+
| ^^^^^^^^^ ambiguous link
2626
|
2727
help: to link to the struct, prefix with `struct@`
2828
|
2929
LL | /// [`struct@ambiguous`] is ambiguous.
30-
| ^^^^^^^^^^^^^^^^^^
30+
| ^^^^^^^
3131
help: to link to the function, add parentheses
3232
|
3333
LL | /// [`ambiguous()`] is ambiguous.
34-
| ^^^^^^^^^^^^^
34+
| ^^
3535

3636
error: `ambiguous` is both a struct and a function
3737
--> $DIR/ambiguity.rs:29:6
@@ -42,30 +42,30 @@ LL | /// [ambiguous] is ambiguous.
4242
help: to link to the struct, prefix with `struct@`
4343
|
4444
LL | /// [struct@ambiguous] is ambiguous.
45-
| ^^^^^^^^^^^^^^^^
45+
| ^^^^^^^
4646
help: to link to the function, add parentheses
4747
|
4848
LL | /// [ambiguous()] is ambiguous.
49-
| ^^^^^^^^^^^
49+
| ^^
5050

5151
error: `multi_conflict` is a struct, a function, and a macro
52-
--> $DIR/ambiguity.rs:31:6
52+
--> $DIR/ambiguity.rs:31:7
5353
|
5454
LL | /// [`multi_conflict`] is a three-way conflict.
55-
| ^^^^^^^^^^^^^^^^ ambiguous link
55+
| ^^^^^^^^^^^^^^ ambiguous link
5656
|
5757
help: to link to the struct, prefix with `struct@`
5858
|
5959
LL | /// [`struct@multi_conflict`] is a three-way conflict.
60-
| ^^^^^^^^^^^^^^^^^^^^^^^
60+
| ^^^^^^^
6161
help: to link to the function, add parentheses
6262
|
6363
LL | /// [`multi_conflict()`] is a three-way conflict.
64-
| ^^^^^^^^^^^^^^^^^^
64+
| ^^
6565
help: to link to the macro, add an exclamation mark
6666
|
6767
LL | /// [`multi_conflict!`] is a three-way conflict.
68-
| ^^^^^^^^^^^^^^^^^
68+
| ^
6969

7070
error: `type_and_value` is both a module and a constant
7171
--> $DIR/ambiguity.rs:33:16
@@ -76,26 +76,26 @@ LL | /// Ambiguous [type_and_value].
7676
help: to link to the module, prefix with `mod@`
7777
|
7878
LL | /// Ambiguous [mod@type_and_value].
79-
| ^^^^^^^^^^^^^^^^^^
79+
| ^^^^
8080
help: to link to the constant, prefix with `const@`
8181
|
8282
LL | /// Ambiguous [const@type_and_value].
83-
| ^^^^^^^^^^^^^^^^^^^^
83+
| ^^^^^^
8484

8585
error: `foo::bar` is both an enum and a function
86-
--> $DIR/ambiguity.rs:35:42
86+
--> $DIR/ambiguity.rs:35:43
8787
|
8888
LL | /// Ambiguous non-implied shortcut link [`foo::bar`].
89-
| ^^^^^^^^^^ ambiguous link
89+
| ^^^^^^^^ ambiguous link
9090
|
9191
help: to link to the enum, prefix with `enum@`
9292
|
9393
LL | /// Ambiguous non-implied shortcut link [`enum@foo::bar`].
94-
| ^^^^^^^^^^^^^^^
94+
| ^^^^^
9595
help: to link to the function, add parentheses
9696
|
9797
LL | /// Ambiguous non-implied shortcut link [`foo::bar()`].
98-
| ^^^^^^^^^^^^
98+
| ^^
9999

100100
error: aborting due to 6 previous errors
101101

src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#![deny(rustdoc::broken_intra_doc_links)]
22
//~^ NOTE lint level is defined
33
pub enum S {}
4+
fn S() {}
45

6+
#[macro_export]
57
macro_rules! m {
68
() => {};
79
}
@@ -41,6 +43,12 @@ trait T {}
4143
//~| NOTE this link resolved
4244
//~| HELP add an exclamation mark
4345

46+
/// Link to [m()]
47+
//~^ ERROR unresolved link to `m`
48+
//~| NOTE this link resolves to the macro `m`
49+
//~| HELP add an exclamation mark
50+
/// and to [m!()]
51+
4452
/// Link to [const@s]
4553
//~^ ERROR incompatible link kind for `s`
4654
//~| NOTE this link resolved
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,139 @@
11
error: incompatible link kind for `S`
2-
--> $DIR/disambiguator-mismatch.rs:14:14
2+
--> $DIR/disambiguator-mismatch.rs:16:14
33
|
44
LL | /// Link to [struct@S]
5-
| ^^^^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S`
5+
| ^^^^^^^^ this link resolved to an enum, which is not a struct
66
|
77
note: the lint level is defined here
88
--> $DIR/disambiguator-mismatch.rs:1:9
99
|
1010
LL | #![deny(rustdoc::broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
= note: this link resolved to an enum, which is not a struct
12+
help: to link to the enum, prefix with `enum@`
13+
|
14+
LL | /// Link to [enum@S]
15+
| ^^^^^
1316

1417
error: incompatible link kind for `S`
15-
--> $DIR/disambiguator-mismatch.rs:19:14
18+
--> $DIR/disambiguator-mismatch.rs:21:14
1619
|
1720
LL | /// Link to [mod@S]
18-
| ^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S`
21+
| ^^^^^ this link resolved to an enum, which is not a module
22+
|
23+
help: to link to the enum, prefix with `enum@`
1924
|
20-
= note: this link resolved to an enum, which is not a module
25+
LL | /// Link to [enum@S]
26+
| ^^^^^
2127

2228
error: incompatible link kind for `S`
23-
--> $DIR/disambiguator-mismatch.rs:24:14
29+
--> $DIR/disambiguator-mismatch.rs:26:14
2430
|
2531
LL | /// Link to [union@S]
26-
| ^^^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S`
32+
| ^^^^^^^ this link resolved to an enum, which is not a union
2733
|
28-
= note: this link resolved to an enum, which is not a union
34+
help: to link to the enum, prefix with `enum@`
35+
|
36+
LL | /// Link to [enum@S]
37+
| ^^^^^
2938

3039
error: incompatible link kind for `S`
31-
--> $DIR/disambiguator-mismatch.rs:29:14
40+
--> $DIR/disambiguator-mismatch.rs:31:14
3241
|
3342
LL | /// Link to [trait@S]
34-
| ^^^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S`
43+
| ^^^^^^^ this link resolved to an enum, which is not a trait
44+
|
45+
help: to link to the enum, prefix with `enum@`
3546
|
36-
= note: this link resolved to an enum, which is not a trait
47+
LL | /// Link to [enum@S]
48+
| ^^^^^
3749

3850
error: incompatible link kind for `T`
39-
--> $DIR/disambiguator-mismatch.rs:34:14
51+
--> $DIR/disambiguator-mismatch.rs:36:14
4052
|
4153
LL | /// Link to [struct@T]
42-
| ^^^^^^^^ help: to link to the trait, prefix with `trait@`: `trait@T`
54+
| ^^^^^^^^ this link resolved to a trait, which is not a struct
4355
|
44-
= note: this link resolved to a trait, which is not a struct
56+
help: to link to the trait, prefix with `trait@`
57+
|
58+
LL | /// Link to [trait@T]
59+
| ^^^^^^
4560

4661
error: incompatible link kind for `m`
47-
--> $DIR/disambiguator-mismatch.rs:39:14
62+
--> $DIR/disambiguator-mismatch.rs:41:14
4863
|
4964
LL | /// Link to [derive@m]
50-
| ^^^^^^^^ help: to link to the macro, add an exclamation mark: `m!`
65+
| ^^^^^^^^ this link resolved to a macro, which is not a derive macro
66+
|
67+
help: to link to the macro, add an exclamation mark
5168
|
52-
= note: this link resolved to a macro, which is not a derive macro
69+
LL | /// Link to [m!]
70+
| --^
71+
72+
error: unresolved link to `m`
73+
--> $DIR/disambiguator-mismatch.rs:46:14
74+
|
75+
LL | /// Link to [m()]
76+
| ^^^ this link resolves to the macro `m`, which is not in the value namespace
77+
|
78+
help: to link to the macro, add an exclamation mark
79+
|
80+
LL | /// Link to [m!()]
81+
| ^
5382

5483
error: incompatible link kind for `s`
55-
--> $DIR/disambiguator-mismatch.rs:44:14
84+
--> $DIR/disambiguator-mismatch.rs:52:14
5685
|
5786
LL | /// Link to [const@s]
58-
| ^^^^^^^ help: to link to the static, prefix with `static@`: `static@s`
87+
| ^^^^^^^ this link resolved to a static, which is not a constant
5988
|
60-
= note: this link resolved to a static, which is not a constant
89+
help: to link to the static, prefix with `static@`
90+
|
91+
LL | /// Link to [static@s]
92+
| ^^^^^^^
6193

6294
error: incompatible link kind for `c`
63-
--> $DIR/disambiguator-mismatch.rs:49:14
95+
--> $DIR/disambiguator-mismatch.rs:57:14
6496
|
6597
LL | /// Link to [static@c]
66-
| ^^^^^^^^ help: to link to the constant, prefix with `const@`: `const@c`
98+
| ^^^^^^^^ this link resolved to a constant, which is not a static
99+
|
100+
help: to link to the constant, prefix with `const@`
67101
|
68-
= note: this link resolved to a constant, which is not a static
102+
LL | /// Link to [const@c]
103+
| ^^^^^^
69104

70105
error: incompatible link kind for `c`
71-
--> $DIR/disambiguator-mismatch.rs:54:14
106+
--> $DIR/disambiguator-mismatch.rs:62:14
72107
|
73108
LL | /// Link to [fn@c]
74-
| ^^^^ help: to link to the constant, prefix with `const@`: `const@c`
109+
| ^^^^ this link resolved to a constant, which is not a function
75110
|
76-
= note: this link resolved to a constant, which is not a function
111+
help: to link to the constant, prefix with `const@`
112+
|
113+
LL | /// Link to [const@c]
114+
| ^^^^^^
77115

78116
error: incompatible link kind for `c`
79-
--> $DIR/disambiguator-mismatch.rs:59:14
117+
--> $DIR/disambiguator-mismatch.rs:67:14
80118
|
81119
LL | /// Link to [c()]
82-
| ^^^ help: to link to the constant, prefix with `const@`: `const@c`
120+
| ^^^ this link resolved to a constant, which is not a function
121+
|
122+
help: to link to the constant, prefix with `const@`
83123
|
84-
= note: this link resolved to a constant, which is not a function
124+
LL | /// Link to [const@c]
125+
| ^^^^^^--
85126

86127
error: incompatible link kind for `f`
87-
--> $DIR/disambiguator-mismatch.rs:64:14
128+
--> $DIR/disambiguator-mismatch.rs:72:14
88129
|
89130
LL | /// Link to [const@f]
90-
| ^^^^^^^ help: to link to the function, add parentheses: `f()`
131+
| ^^^^^^^ this link resolved to a function, which is not a constant
132+
|
133+
help: to link to the function, add parentheses
91134
|
92-
= note: this link resolved to a function, which is not a constant
135+
LL | /// Link to [f()]
136+
| --^^
93137

94-
error: aborting due to 11 previous errors
138+
error: aborting due to 12 previous errors
95139

src/test/rustdoc-ui/intra-doc/errors.stderr

+30-20
Original file line numberDiff line numberDiff line change
@@ -92,37 +92,45 @@ error: unresolved link to `Vec::into_iter`
9292
--> $DIR/errors.rs:63:6
9393
|
9494
LL | /// [type@Vec::into_iter]
95-
| ^^^^^^^^^^^^^^^^^^^
96-
| |
97-
| this link resolves to the associated function `into_iter`, which is not in the type namespace
98-
| help: to link to the associated function, add parentheses: `Vec::into_iter()`
95+
| ^^^^^^^^^^^^^^^^^^^ this link resolves to the associated function `into_iter`, which is not in the type namespace
96+
|
97+
help: to link to the associated function, add parentheses
98+
|
99+
LL | /// [Vec::into_iter()]
100+
| -- ^^
99101

100102
error: unresolved link to `S`
101103
--> $DIR/errors.rs:68:6
102104
|
103105
LL | /// [S!]
104-
| ^^
105-
| |
106-
| this link resolves to the struct `S`, which is not in the macro namespace
107-
| help: to link to the struct, prefix with `struct@`: `struct@S`
106+
| ^^ this link resolves to the struct `S`, which is not in the macro namespace
107+
|
108+
help: to link to the struct, prefix with `struct@`
109+
|
110+
LL | /// [struct@S]
111+
| ^^^^^^^--
108112

109113
error: unresolved link to `S::h`
110114
--> $DIR/errors.rs:78:6
111115
|
112116
LL | /// [type@S::h]
113-
| ^^^^^^^^^
114-
| |
115-
| this link resolves to the associated function `h`, which is not in the type namespace
116-
| help: to link to the associated function, add parentheses: `S::h()`
117+
| ^^^^^^^^^ this link resolves to the associated function `h`, which is not in the type namespace
118+
|
119+
help: to link to the associated function, add parentheses
120+
|
121+
LL | /// [S::h()]
122+
| -- ^^
117123

118124
error: unresolved link to `T::g`
119125
--> $DIR/errors.rs:86:6
120126
|
121127
LL | /// [type@T::g]
122-
| ^^^^^^^^^
123-
| |
124-
| this link resolves to the associated function `g`, which is not in the type namespace
125-
| help: to link to the associated function, add parentheses: `T::g()`
128+
| ^^^^^^^^^ this link resolves to the associated function `g`, which is not in the type namespace
129+
|
130+
help: to link to the associated function, add parentheses
131+
|
132+
LL | /// [T::g()]
133+
| -- ^^
126134

127135
error: unresolved link to `T::h`
128136
--> $DIR/errors.rs:91:6
@@ -134,10 +142,12 @@ error: unresolved link to `m`
134142
--> $DIR/errors.rs:98:6
135143
|
136144
LL | /// [m()]
137-
| ^^^
138-
| |
139-
| this link resolves to the macro `m`, which is not in the value namespace
140-
| help: to link to the macro, add an exclamation mark: `m!`
145+
| ^^^ this link resolves to the macro `m`, which is not in the value namespace
146+
|
147+
help: to link to the macro, add an exclamation mark
148+
|
149+
LL | /// [m!()]
150+
| ^
141151

142152
error: aborting due to 20 previous errors
143153

0 commit comments

Comments
 (0)