Skip to content

Commit 332e8a0

Browse files
authored
Rollup merge of rust-lang#101720 - GuillaumeGomez:warn-INVALID_HTML_TAGS, r=notriddle
Change default level of INVALID_HTML_TAGS to warning and stabilize it Fixes of rust-lang#67799. cc `@Nemo157` r? `@notriddle`
2 parents b59e6cb + f92d294 commit 332e8a0

File tree

5 files changed

+82
-19
lines changed

5 files changed

+82
-19
lines changed

src/librustdoc/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ declare_rustdoc_lint! {
148148
///
149149
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
150150
INVALID_HTML_TAGS,
151-
Allow,
151+
Warn,
152152
"detects invalid HTML tags in doc comments"
153153
}
154154

src/librustdoc/passes/html_tags.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ struct InvalidHtmlTagsLinter<'a, 'tcx> {
2222
}
2323

2424
pub(crate) fn check_invalid_html_tags(krate: Crate, cx: &mut DocContext<'_>) -> Crate {
25-
if cx.tcx.sess.is_nightly_build() {
26-
let mut coll = InvalidHtmlTagsLinter { cx };
27-
coll.visit_crate(&krate);
28-
}
25+
let mut coll = InvalidHtmlTagsLinter { cx };
26+
coll.visit_crate(&krate);
2927
krate
3028
}
3129

src/test/rustdoc-ui/intra-doc/malformed-generics.rs

+9
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@
33
//! [Vec<] //~ ERROR
44
//! [Vec<Box<T] //~ ERROR
55
//! [Vec<Box<T>] //~ ERROR
6+
//~^ WARN
67
//! [Vec<Box<T>>>] //~ ERROR
8+
//~^ WARN
79
//! [Vec<T>>>] //~ ERROR
10+
//~^ WARN
811
//! [<Vec] //~ ERROR
912
//! [Vec::<] //~ ERROR
1013
//! [<T>] //~ ERROR
14+
//~^ WARN
1115
//! [<invalid syntax>] //~ ERROR
16+
//~^ WARN
1217
//! [Vec:<T>:new()] //~ ERROR
18+
//~^ WARN
1319
//! [Vec<<T>>] //~ ERROR
20+
//~^ WARN
1421
//! [Vec<>] //~ ERROR
1522
//! [Vec<<>>] //~ ERROR
1623
1724
// FIXME(#74563) support UFCS
1825
//! [<Vec as IntoIterator>::into_iter] //~ ERROR
26+
//~^ WARN
1927
//! [<Vec<T> as IntoIterator>::iter] //~ ERROR
28+
//~^ WARN

src/test/rustdoc-ui/intra-doc/malformed-generics.stderr

+69-13
Original file line numberDiff line numberDiff line change
@@ -23,80 +23,136 @@ LL | //! [Vec<Box<T>]
2323
| ^^^^^^^^^^ unbalanced angle brackets
2424

2525
error: unresolved link to `Vec<Box<T>>>`
26-
--> $DIR/malformed-generics.rs:6:6
26+
--> $DIR/malformed-generics.rs:7:6
2727
|
2828
LL | //! [Vec<Box<T>>>]
2929
| ^^^^^^^^^^^^ unbalanced angle brackets
3030

3131
error: unresolved link to `Vec<T>>>`
32-
--> $DIR/malformed-generics.rs:7:6
32+
--> $DIR/malformed-generics.rs:9:6
3333
|
3434
LL | //! [Vec<T>>>]
3535
| ^^^^^^^^ unbalanced angle brackets
3636

3737
error: unresolved link to `<Vec`
38-
--> $DIR/malformed-generics.rs:8:6
38+
--> $DIR/malformed-generics.rs:11:6
3939
|
4040
LL | //! [<Vec]
4141
| ^^^^ unbalanced angle brackets
4242

4343
error: unresolved link to `Vec::<`
44-
--> $DIR/malformed-generics.rs:9:6
44+
--> $DIR/malformed-generics.rs:12:6
4545
|
4646
LL | //! [Vec::<]
4747
| ^^^^^^ unbalanced angle brackets
4848

4949
error: unresolved link to `<T>`
50-
--> $DIR/malformed-generics.rs:10:6
50+
--> $DIR/malformed-generics.rs:13:6
5151
|
5252
LL | //! [<T>]
5353
| ^^^ missing type for generic parameters
5454

5555
error: unresolved link to `<invalid syntax>`
56-
--> $DIR/malformed-generics.rs:11:6
56+
--> $DIR/malformed-generics.rs:15:6
5757
|
5858
LL | //! [<invalid syntax>]
5959
| ^^^^^^^^^^^^^^^^ missing type for generic parameters
6060

6161
error: unresolved link to `Vec:<T>:new`
62-
--> $DIR/malformed-generics.rs:12:6
62+
--> $DIR/malformed-generics.rs:17:6
6363
|
6464
LL | //! [Vec:<T>:new()]
6565
| ^^^^^^^^^^^^^ has invalid path separator
6666

6767
error: unresolved link to `Vec<<T>>`
68-
--> $DIR/malformed-generics.rs:13:6
68+
--> $DIR/malformed-generics.rs:19:6
6969
|
7070
LL | //! [Vec<<T>>]
7171
| ^^^^^^^^ too many angle brackets
7272

7373
error: unresolved link to `Vec<>`
74-
--> $DIR/malformed-generics.rs:14:6
74+
--> $DIR/malformed-generics.rs:21:6
7575
|
7676
LL | //! [Vec<>]
7777
| ^^^^^ empty angle brackets
7878

7979
error: unresolved link to `Vec<<>>`
80-
--> $DIR/malformed-generics.rs:15:6
80+
--> $DIR/malformed-generics.rs:22:6
8181
|
8282
LL | //! [Vec<<>>]
8383
| ^^^^^^^ too many angle brackets
8484

8585
error: unresolved link to `<Vec as IntoIterator>::into_iter`
86-
--> $DIR/malformed-generics.rs:18:6
86+
--> $DIR/malformed-generics.rs:25:6
8787
|
8888
LL | //! [<Vec as IntoIterator>::into_iter]
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported
9090
|
9191
= note: see https://github.com/rust-lang/rust/issues/74563 for more information
9292

9393
error: unresolved link to `<Vec<T> as IntoIterator>::iter`
94-
--> $DIR/malformed-generics.rs:19:6
94+
--> $DIR/malformed-generics.rs:27:6
9595
|
9696
LL | //! [<Vec<T> as IntoIterator>::iter]
9797
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported
9898
|
9999
= note: see https://github.com/rust-lang/rust/issues/74563 for more information
100100

101-
error: aborting due to 15 previous errors
101+
warning: unclosed HTML tag `T`
102+
--> $DIR/malformed-generics.rs:5:13
103+
|
104+
LL | //! [Vec<Box<T>]
105+
| ^^^
106+
|
107+
= note: `#[warn(rustdoc::invalid_html_tags)]` on by default
108+
109+
warning: unclosed HTML tag `T`
110+
--> $DIR/malformed-generics.rs:7:13
111+
|
112+
LL | //! [Vec<Box<T>>>]
113+
| ^^^
114+
115+
warning: unclosed HTML tag `T`
116+
--> $DIR/malformed-generics.rs:9:9
117+
|
118+
LL | //! [Vec<T>>>]
119+
| ^^^
120+
121+
warning: unclosed HTML tag `T`
122+
--> $DIR/malformed-generics.rs:13:6
123+
|
124+
LL | //! [<T>]
125+
| ^^^
126+
127+
warning: unclosed HTML tag `invalid`
128+
--> $DIR/malformed-generics.rs:15:6
129+
|
130+
LL | //! [<invalid syntax>]
131+
| ^^^^^^^^
132+
133+
warning: unclosed HTML tag `T`
134+
--> $DIR/malformed-generics.rs:17:10
135+
|
136+
LL | //! [Vec:<T>:new()]
137+
| ^^^
138+
139+
warning: unclosed HTML tag `T`
140+
--> $DIR/malformed-generics.rs:19:10
141+
|
142+
LL | //! [Vec<<T>>]
143+
| ^^^
144+
145+
warning: unclosed HTML tag `Vec`
146+
--> $DIR/malformed-generics.rs:25:6
147+
|
148+
LL | //! [<Vec as IntoIterator>::into_iter]
149+
| ^^^^
150+
151+
warning: unclosed HTML tag `T`
152+
--> $DIR/malformed-generics.rs:27:10
153+
|
154+
LL | //! [<Vec<T> as IntoIterator>::iter]
155+
| ^^^
156+
157+
error: aborting due to 15 previous errors; 9 warnings emitted
102158

src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
//! [`empty`]
1717
1818
// @has - '//a[@href="../empty2/index.html"]' 'empty2'
19-
//! [empty2<x>]
19+
//! [`empty2<x>`]

0 commit comments

Comments
 (0)