Skip to content

Commit bc6ec6f

Browse files
Add test for unclosed_html_tag lint
1 parent 5fcbf46 commit bc6ec6f

File tree

4 files changed

+89
-65
lines changed

4 files changed

+89
-65
lines changed

src/test/rustdoc-ui/intra-link-errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unclosed_html_tags)]
1+
#![allow(invalid_html_tags)]
22
#![deny(broken_intra_doc_links)]
33
//~^ NOTE lint level is defined
44

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

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -28,97 +28,68 @@ error: unresolved link to `std::io::not::here`
2828
LL | /// [std::io::not::here]
2929
| ^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
3030

31-
<<<<<<< HEAD
3231
error: unresolved link to `std::io::not::here`
33-
--> $DIR/intra-link-errors.rs:23:6
34-
=======
35-
error: unresolved link to `std::io::Error::x`
3632
--> $DIR/intra-link-errors.rs:24:6
37-
>>>>>>> Add `unclosed_html_tags` lint
3833
|
3934
LL | /// [type@std::io::not::here]
4035
| ^^^^^^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
4136

4237
error: unresolved link to `std::io::Error::x`
43-
--> $DIR/intra-link-errors.rs:27:6
38+
--> $DIR/intra-link-errors.rs:28:6
4439
|
4540
LL | /// [std::io::Error::x]
4641
| ^^^^^^^^^^^^^^^^^ the struct `Error` has no field or associated item named `x`
4742

4843
error: unresolved link to `std::io::ErrorKind::x`
49-
<<<<<<< HEAD
50-
--> $DIR/intra-link-errors.rs:31:6
51-
=======
52-
--> $DIR/intra-link-errors.rs:28:6
53-
>>>>>>> Add `unclosed_html_tags` lint
44+
--> $DIR/intra-link-errors.rs:32:6
5445
|
5546
LL | /// [std::io::ErrorKind::x]
5647
| ^^^^^^^^^^^^^^^^^^^^^ the enum `ErrorKind` has no variant or associated item named `x`
5748

5849
error: unresolved link to `f::A`
59-
<<<<<<< HEAD
60-
--> $DIR/intra-link-errors.rs:35:6
61-
=======
62-
--> $DIR/intra-link-errors.rs:32:6
63-
>>>>>>> Add `unclosed_html_tags` lint
50+
--> $DIR/intra-link-errors.rs:36:6
6451
|
6552
LL | /// [f::A]
6653
| ^^^^ `f` is a function, not a module or type, and cannot have associated items
6754

6855
error: unresolved link to `f::A`
69-
--> $DIR/intra-link-errors.rs:39:6
56+
--> $DIR/intra-link-errors.rs:40:6
7057
|
7158
LL | /// [f::A!]
7259
| ^^^^^ `f` is a function, not a module or type, and cannot have associated items
7360

7461
error: unresolved link to `S::A`
75-
<<<<<<< HEAD
76-
--> $DIR/intra-link-errors.rs:43:6
77-
=======
78-
--> $DIR/intra-link-errors.rs:36:6
79-
>>>>>>> Add `unclosed_html_tags` lint
62+
--> $DIR/intra-link-errors.rs:44:6
8063
|
8164
LL | /// [S::A]
8265
| ^^^^ the struct `S` has no field or associated item named `A`
8366

8467
error: unresolved link to `S::fmt`
85-
<<<<<<< HEAD
86-
--> $DIR/intra-link-errors.rs:47:6
87-
=======
88-
--> $DIR/intra-link-errors.rs:40:6
89-
>>>>>>> Add `unclosed_html_tags` lint
68+
--> $DIR/intra-link-errors.rs:48:6
9069
|
9170
LL | /// [S::fmt]
9271
| ^^^^^^ the struct `S` has no field or associated item named `fmt`
9372

9473
error: unresolved link to `E::D`
95-
<<<<<<< HEAD
96-
--> $DIR/intra-link-errors.rs:51:6
97-
=======
98-
--> $DIR/intra-link-errors.rs:44:6
99-
>>>>>>> Add `unclosed_html_tags` lint
74+
--> $DIR/intra-link-errors.rs:52:6
10075
|
10176
LL | /// [E::D]
10277
| ^^^^ the enum `E` has no variant or associated item named `D`
10378

10479
error: unresolved link to `u8::not_found`
105-
<<<<<<< HEAD
106-
--> $DIR/intra-link-errors.rs:55:6
107-
=======
108-
--> $DIR/intra-link-errors.rs:48:6
109-
>>>>>>> Add `unclosed_html_tags` lint
80+
--> $DIR/intra-link-errors.rs:56:6
11081
|
11182
LL | /// [u8::not_found]
11283
| ^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found`
11384

11485
error: unresolved link to `std::primitive::u8::not_found`
115-
--> $DIR/intra-link-errors.rs:59:6
86+
--> $DIR/intra-link-errors.rs:60:6
11687
|
11788
LL | /// [std::primitive::u8::not_found]
11889
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found`
11990

12091
error: unresolved link to `Vec::into_iter`
121-
--> $DIR/intra-link-errors.rs:63:6
92+
--> $DIR/intra-link-errors.rs:64:6
12293
|
12394
LL | /// [type@Vec::into_iter]
12495
| ^^^^^^^^^^^^^^^^^^^
@@ -127,11 +98,7 @@ LL | /// [type@Vec::into_iter]
12798
| help: to link to the associated function, add parentheses: `Vec::into_iter()`
12899

129100
error: unresolved link to `S`
130-
<<<<<<< HEAD
131-
--> $DIR/intra-link-errors.rs:68:6
132-
=======
133-
--> $DIR/intra-link-errors.rs:52:6
134-
>>>>>>> Add `unclosed_html_tags` lint
101+
--> $DIR/intra-link-errors.rs:69:6
135102
|
136103
LL | /// [S!]
137104
| ^^
@@ -140,11 +107,7 @@ LL | /// [S!]
140107
| help: to link to the struct, prefix with `struct@`: `struct@S`
141108

142109
error: unresolved link to `T::g`
143-
<<<<<<< HEAD
144-
--> $DIR/intra-link-errors.rs:86:6
145-
=======
146-
--> $DIR/intra-link-errors.rs:70:6
147-
>>>>>>> Add `unclosed_html_tags` lint
110+
--> $DIR/intra-link-errors.rs:87:6
148111
|
149112
LL | /// [type@T::g]
150113
| ^^^^^^^^^
@@ -153,21 +116,13 @@ LL | /// [type@T::g]
153116
| help: to link to the associated function, add parentheses: `T::g()`
154117

155118
error: unresolved link to `T::h`
156-
<<<<<<< HEAD
157-
--> $DIR/intra-link-errors.rs:91:6
158-
=======
159-
--> $DIR/intra-link-errors.rs:75:6
160-
>>>>>>> Add `unclosed_html_tags` lint
119+
--> $DIR/intra-link-errors.rs:92:6
161120
|
162121
LL | /// [T::h!]
163122
| ^^^^^ the trait `T` has no macro named `h`
164123

165124
error: unresolved link to `S::h`
166-
<<<<<<< HEAD
167-
--> $DIR/intra-link-errors.rs:78:6
168-
=======
169-
--> $DIR/intra-link-errors.rs:62:6
170-
>>>>>>> Add `unclosed_html_tags` lint
125+
--> $DIR/intra-link-errors.rs:79:6
171126
|
172127
LL | /// [type@S::h]
173128
| ^^^^^^^^^
@@ -176,11 +131,7 @@ LL | /// [type@S::h]
176131
| help: to link to the associated function, add parentheses: `S::h()`
177132

178133
error: unresolved link to `m`
179-
<<<<<<< HEAD
180-
--> $DIR/intra-link-errors.rs:98:6
181-
=======
182-
--> $DIR/intra-link-errors.rs:82:6
183-
>>>>>>> Add `unclosed_html_tags` lint
134+
--> $DIR/intra-link-errors.rs:99:6
184135
|
185136
LL | /// [m()]
186137
| ^^^
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![deny(invalid_html_tags)]
2+
3+
/// <script>
4+
//~^ ERROR unclosed HTML tag `unknown`
5+
//~^^ ERROR unclosed HTML tag `script`
6+
/// <img><input>
7+
/// </script>
8+
/// <unknown>
9+
/// < ok
10+
/// <script>
11+
pub fn foo() {}
12+
13+
/// <h1>
14+
//~^ ERROR unopened HTML tag `h2`
15+
//~^^ ERROR unopened HTML tag `h3`
16+
/// <h2>
17+
/// <h3>
18+
/// </h1>
19+
pub fn f() {}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
error: unclosed HTML tag `unknown`
2+
--> $DIR/invalid-html-tags.rs:3:1
3+
|
4+
LL | / /// <script>
5+
LL | |
6+
LL | |
7+
LL | | /// <img><input>
8+
... |
9+
LL | | /// < ok
10+
LL | | /// <script>
11+
| |____________^
12+
|
13+
note: the lint level is defined here
14+
--> $DIR/invalid-html-tags.rs:1:9
15+
|
16+
LL | #![deny(invalid_html_tags)]
17+
| ^^^^^^^^^^^^^^^^^
18+
19+
error: unclosed HTML tag `script`
20+
--> $DIR/invalid-html-tags.rs:3:1
21+
|
22+
LL | / /// <script>
23+
LL | |
24+
LL | |
25+
LL | | /// <img><input>
26+
... |
27+
LL | | /// < ok
28+
LL | | /// <script>
29+
| |____________^
30+
31+
error: unopened HTML tag `h2`
32+
--> $DIR/invalid-html-tags.rs:13:1
33+
|
34+
LL | / /// <h1>
35+
LL | |
36+
LL | |
37+
LL | | /// <h2>
38+
LL | | /// <h3>
39+
LL | | /// </h1>
40+
| |_________^
41+
42+
error: unopened HTML tag `h3`
43+
--> $DIR/invalid-html-tags.rs:13:1
44+
|
45+
LL | / /// <h1>
46+
LL | |
47+
LL | |
48+
LL | | /// <h2>
49+
LL | | /// <h3>
50+
LL | | /// </h1>
51+
| |_________^
52+
53+
error: aborting due to 4 previous errors
54+

0 commit comments

Comments
 (0)