diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 94a493992e593..2f6686f81965b 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -411,7 +411,7 @@ struct HandlerInner { /// would be unnecessary repetition. taught_diagnostics: FxHashSet, - /// Used to suggest rustc --explain + /// Used to suggest rustc --explain `` emitted_diagnostic_codes: FxIndexSet, /// This set contains a hash of every diagnostic that has been emitted by diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs index e76c19a61c541..3aad97bc296fb 100644 --- a/src/librustdoc/lint.rs +++ b/src/librustdoc/lint.rs @@ -148,7 +148,7 @@ declare_rustdoc_lint! { /// /// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags INVALID_HTML_TAGS, - Allow, + Warn, "detects invalid HTML tags in doc comments" } diff --git a/src/librustdoc/passes/html_tags.rs b/src/librustdoc/passes/html_tags.rs index 694b03161d929..67fc71665ccf7 100644 --- a/src/librustdoc/passes/html_tags.rs +++ b/src/librustdoc/passes/html_tags.rs @@ -22,10 +22,8 @@ struct InvalidHtmlTagsLinter<'a, 'tcx> { } pub(crate) fn check_invalid_html_tags(krate: Crate, cx: &mut DocContext<'_>) -> Crate { - if cx.tcx.sess.is_nightly_build() { - let mut coll = InvalidHtmlTagsLinter { cx }; - coll.visit_crate(&krate); - } + let mut coll = InvalidHtmlTagsLinter { cx }; + coll.visit_crate(&krate); krate } diff --git a/src/test/rustdoc-ui/intra-doc/malformed-generics.rs b/src/test/rustdoc-ui/intra-doc/malformed-generics.rs index 15e02925ed90d..161625ed28c29 100644 --- a/src/test/rustdoc-ui/intra-doc/malformed-generics.rs +++ b/src/test/rustdoc-ui/intra-doc/malformed-generics.rs @@ -3,17 +3,26 @@ //! [Vec<] //~ ERROR //! [Vec] //~ ERROR +//~^ WARN //! [Vec>>] //~ ERROR +//~^ WARN //! [Vec>>] //~ ERROR +//~^ WARN //! [] //~ ERROR +//~^ WARN //! [] //~ ERROR +//~^ WARN //! [Vec::new()] //~ ERROR +//~^ WARN //! [Vec<>] //~ ERROR +//~^ WARN //! [Vec<>] //~ ERROR //! [Vec<<>>] //~ ERROR // FIXME(#74563) support UFCS //! [::into_iter] //~ ERROR +//~^ WARN //! [ as IntoIterator>::iter] //~ ERROR +//~^ WARN diff --git a/src/test/rustdoc-ui/intra-doc/malformed-generics.stderr b/src/test/rustdoc-ui/intra-doc/malformed-generics.stderr index 5bc0f84e24d13..08349fef88d38 100644 --- a/src/test/rustdoc-ui/intra-doc/malformed-generics.stderr +++ b/src/test/rustdoc-ui/intra-doc/malformed-generics.stderr @@ -23,67 +23,67 @@ LL | //! [Vec] | ^^^^^^^^^^ unbalanced angle brackets error: unresolved link to `Vec>>` - --> $DIR/malformed-generics.rs:6:6 + --> $DIR/malformed-generics.rs:7:6 | LL | //! [Vec>>] | ^^^^^^^^^^^^ unbalanced angle brackets error: unresolved link to `Vec>>` - --> $DIR/malformed-generics.rs:7:6 + --> $DIR/malformed-generics.rs:9:6 | LL | //! [Vec>>] | ^^^^^^^^ unbalanced angle brackets error: unresolved link to ` $DIR/malformed-generics.rs:8:6 + --> $DIR/malformed-generics.rs:11:6 | LL | //! [ $DIR/malformed-generics.rs:9:6 + --> $DIR/malformed-generics.rs:12:6 | LL | //! [Vec::<] | ^^^^^^ unbalanced angle brackets error: unresolved link to `` - --> $DIR/malformed-generics.rs:10:6 + --> $DIR/malformed-generics.rs:13:6 | LL | //! [] | ^^^ missing type for generic parameters error: unresolved link to `` - --> $DIR/malformed-generics.rs:11:6 + --> $DIR/malformed-generics.rs:15:6 | LL | //! [] | ^^^^^^^^^^^^^^^^ missing type for generic parameters error: unresolved link to `Vec::new` - --> $DIR/malformed-generics.rs:12:6 + --> $DIR/malformed-generics.rs:17:6 | LL | //! [Vec::new()] | ^^^^^^^^^^^^^ has invalid path separator error: unresolved link to `Vec<>` - --> $DIR/malformed-generics.rs:13:6 + --> $DIR/malformed-generics.rs:19:6 | LL | //! [Vec<>] | ^^^^^^^^ too many angle brackets error: unresolved link to `Vec<>` - --> $DIR/malformed-generics.rs:14:6 + --> $DIR/malformed-generics.rs:21:6 | LL | //! [Vec<>] | ^^^^^ empty angle brackets error: unresolved link to `Vec<<>>` - --> $DIR/malformed-generics.rs:15:6 + --> $DIR/malformed-generics.rs:22:6 | LL | //! [Vec<<>>] | ^^^^^^^ too many angle brackets error: unresolved link to `::into_iter` - --> $DIR/malformed-generics.rs:18:6 + --> $DIR/malformed-generics.rs:25:6 | LL | //! [::into_iter] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported @@ -91,12 +91,68 @@ LL | //! [::into_iter] = note: see https://github.com/rust-lang/rust/issues/74563 for more information error: unresolved link to ` as IntoIterator>::iter` - --> $DIR/malformed-generics.rs:19:6 + --> $DIR/malformed-generics.rs:27:6 | LL | //! [ as IntoIterator>::iter] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported | = note: see https://github.com/rust-lang/rust/issues/74563 for more information -error: aborting due to 15 previous errors +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:5:13 + | +LL | //! [Vec] + | ^^^ + | + = note: `#[warn(rustdoc::invalid_html_tags)]` on by default + +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:7:13 + | +LL | //! [Vec>>] + | ^^^ + +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:9:9 + | +LL | //! [Vec>>] + | ^^^ + +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:13:6 + | +LL | //! [] + | ^^^ + +warning: unclosed HTML tag `invalid` + --> $DIR/malformed-generics.rs:15:6 + | +LL | //! [] + | ^^^^^^^^ + +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:17:10 + | +LL | //! [Vec::new()] + | ^^^ + +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:19:10 + | +LL | //! [Vec<>] + | ^^^ + +warning: unclosed HTML tag `Vec` + --> $DIR/malformed-generics.rs:25:6 + | +LL | //! [::into_iter] + | ^^^^ + +warning: unclosed HTML tag `T` + --> $DIR/malformed-generics.rs:27:10 + | +LL | //! [ as IntoIterator>::iter] + | ^^^ + +error: aborting due to 15 previous errors; 9 warnings emitted diff --git a/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs b/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs index 5d8dcf8bc1d16..ad50887e9221c 100644 --- a/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs +++ b/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs @@ -16,4 +16,4 @@ //! [`empty`] // @has - '//a[@href="../empty2/index.html"]' 'empty2' -//! [empty2] +//! [`empty2`]