Skip to content

Commit f9a65af

Browse files
Make invalid_html_tags lint only run on nightly and being allowed by default
1 parent 6271a0a commit f9a65af

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

compiler/rustc_session/src/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ declare_lint! {
18871887
///
18881888
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
18891889
pub INVALID_HTML_TAGS,
1890-
Warn,
1890+
Allow,
18911891
"detects invalid HTML tags in doc comments"
18921892
}
18931893

src/doc/rustdoc/src/lints.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ typo mistakes for some common attributes.
253253

254254
## invalid_html_tags
255255

256-
This lint **warns by default**. It detects unclosed or invalid HTML tags.
257-
For example:
256+
This lint is **allowed by default** and is **nightly-only**. It detects unclosed
257+
or invalid HTML tags. For example:
258258

259259
```rust
260+
#![warn(invalid_html_tags)]
261+
260262
/// <h1>
261263
/// </script>
262264
pub fn foo() {}

src/librustdoc/passes/html_tags.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ use crate::fold::DocFolder;
55
use crate::html::markdown::opts;
66
use core::ops::Range;
77
use pulldown_cmark::{Event, Parser};
8-
// use rustc_hir::hir_id::HirId;
8+
use rustc_feature::UnstableFeatures;
99
use rustc_session::lint;
10-
// use rustc_span::Span;
1110

1211
pub const CHECK_INVALID_HTML_TAGS: Pass = Pass {
1312
name: "check-invalid-html-tags",
@@ -26,9 +25,13 @@ impl<'a, 'tcx> InvalidHtmlTagsLinter<'a, 'tcx> {
2625
}
2726

2827
pub fn check_invalid_html_tags(krate: Crate, cx: &DocContext<'_>) -> Crate {
29-
let mut coll = InvalidHtmlTagsLinter::new(cx);
28+
if !UnstableFeatures::from_environment().is_nightly_build() {
29+
krate
30+
} else {
31+
let mut coll = InvalidHtmlTagsLinter::new(cx);
3032

31-
coll.fold_crate(krate)
33+
coll.fold_crate(krate)
34+
}
3235
}
3336

3437
const ALLOWED_UNCLOSED: &[&str] = &[

0 commit comments

Comments
 (0)