about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-10 21:41:02 +0000
committerbors <bors@rust-lang.org>2022-10-10 21:41:02 +0000
commit36c8e291a617ae6bd4b8ff13c54c82862eaf0eec (patch)
treeb38170662d2d265859e26ac69489240c3bea2924 /src
parenta6b7274a462829f8ef08a1ddcdcec7ac80dbf3e1 (diff)
parentd565200270d425ab2d72b06109314c786676f593 (diff)
Auto merge of #101720 - GuillaumeGomez:warn-INVALID_HTML_TAGS, r=notriddle
Change default level of INVALID_HTML_TAGS to warning and stabilize it

Fixes of #67799.

cc `@Nemo157`
r? `@notriddle`
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/lint.rs2
-rw-r--r--src/librustdoc/passes/html_tags.rs6
-rw-r--r--src/test/rustdoc-ui/intra-doc/malformed-generics.rs9
-rw-r--r--src/test/rustdoc-ui/intra-doc/malformed-generics.stderr82
-rw-r--r--src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/lib.rs6
-rw-r--r--src/tools/rustfmt/src/config/config_type.rs2
7 files changed, 86 insertions, 23 deletions
diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs
index e76c19a61c5..3aad97bc296 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 694b03161d9..67fc71665cc 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 15e02925ed9..161625ed28c 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<Box<T] //~ ERROR
 //! [Vec<Box<T>] //~ ERROR
+//~^ WARN
 //! [Vec<Box<T>>>] //~ ERROR
+//~^ WARN
 //! [Vec<T>>>] //~ ERROR
+//~^ WARN
 //! [<Vec] //~ ERROR
 //! [Vec::<] //~ ERROR
 //! [<T>] //~ ERROR
+//~^ WARN
 //! [<invalid syntax>] //~ ERROR
+//~^ WARN
 //! [Vec:<T>:new()] //~ ERROR
+//~^ WARN
 //! [Vec<<T>>] //~ ERROR
+//~^ WARN
 //! [Vec<>] //~ ERROR
 //! [Vec<<>>] //~ ERROR
 
 // FIXME(#74563) support UFCS
 //! [<Vec as IntoIterator>::into_iter] //~ ERROR
+//~^ WARN
 //! [<Vec<T> 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 5bc0f84e24d..08349fef88d 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<Box<T>]
    |      ^^^^^^^^^^ unbalanced angle brackets
 
 error: unresolved link to `Vec<Box<T>>>`
-  --> $DIR/malformed-generics.rs:6:6
+  --> $DIR/malformed-generics.rs:7:6
    |
 LL | //! [Vec<Box<T>>>]
    |      ^^^^^^^^^^^^ unbalanced angle brackets
 
 error: unresolved link to `Vec<T>>>`
-  --> $DIR/malformed-generics.rs:7:6
+  --> $DIR/malformed-generics.rs:9:6
    |
 LL | //! [Vec<T>>>]
    |      ^^^^^^^^ unbalanced angle brackets
 
 error: unresolved link to `<Vec`
-  --> $DIR/malformed-generics.rs:8:6
+  --> $DIR/malformed-generics.rs:11:6
    |
 LL | //! [<Vec]
    |      ^^^^ unbalanced angle brackets
 
 error: unresolved link to `Vec::<`
-  --> $DIR/malformed-generics.rs:9:6
+  --> $DIR/malformed-generics.rs:12:6
    |
 LL | //! [Vec::<]
    |      ^^^^^^ unbalanced angle brackets
 
 error: unresolved link to `<T>`
-  --> $DIR/malformed-generics.rs:10:6
+  --> $DIR/malformed-generics.rs:13:6
    |
 LL | //! [<T>]
    |      ^^^ missing type for generic parameters
 
 error: unresolved link to `<invalid syntax>`
-  --> $DIR/malformed-generics.rs:11:6
+  --> $DIR/malformed-generics.rs:15:6
    |
 LL | //! [<invalid syntax>]
    |      ^^^^^^^^^^^^^^^^ missing type for generic parameters
 
 error: unresolved link to `Vec:<T>:new`
-  --> $DIR/malformed-generics.rs:12:6
+  --> $DIR/malformed-generics.rs:17:6
    |
 LL | //! [Vec:<T>:new()]
    |      ^^^^^^^^^^^^^ has invalid path separator
 
 error: unresolved link to `Vec<<T>>`
-  --> $DIR/malformed-generics.rs:13:6
+  --> $DIR/malformed-generics.rs:19:6
    |
 LL | //! [Vec<<T>>]
    |      ^^^^^^^^ 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 `<Vec as IntoIterator>::into_iter`
-  --> $DIR/malformed-generics.rs:18:6
+  --> $DIR/malformed-generics.rs:25:6
    |
 LL | //! [<Vec as IntoIterator>::into_iter]
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported
@@ -91,12 +91,68 @@ LL | //! [<Vec as IntoIterator>::into_iter]
    = note: see https://github.com/rust-lang/rust/issues/74563 for more information
 
 error: unresolved link to `<Vec<T> as IntoIterator>::iter`
-  --> $DIR/malformed-generics.rs:19:6
+  --> $DIR/malformed-generics.rs:27:6
    |
 LL | //! [<Vec<T> 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<Box<T>]
+   |             ^^^
+   |
+   = note: `#[warn(rustdoc::invalid_html_tags)]` on by default
+
+warning: unclosed HTML tag `T`
+  --> $DIR/malformed-generics.rs:7:13
+   |
+LL | //! [Vec<Box<T>>>]
+   |             ^^^
+
+warning: unclosed HTML tag `T`
+  --> $DIR/malformed-generics.rs:9:9
+   |
+LL | //! [Vec<T>>>]
+   |         ^^^
+
+warning: unclosed HTML tag `T`
+  --> $DIR/malformed-generics.rs:13:6
+   |
+LL | //! [<T>]
+   |      ^^^
+
+warning: unclosed HTML tag `invalid`
+  --> $DIR/malformed-generics.rs:15:6
+   |
+LL | //! [<invalid syntax>]
+   |      ^^^^^^^^
+
+warning: unclosed HTML tag `T`
+  --> $DIR/malformed-generics.rs:17:10
+   |
+LL | //! [Vec:<T>:new()]
+   |          ^^^
+
+warning: unclosed HTML tag `T`
+  --> $DIR/malformed-generics.rs:19:10
+   |
+LL | //! [Vec<<T>>]
+   |          ^^^
+
+warning: unclosed HTML tag `Vec`
+  --> $DIR/malformed-generics.rs:25:6
+   |
+LL | //! [<Vec as IntoIterator>::into_iter]
+   |      ^^^^
+
+warning: unclosed HTML tag `T`
+  --> $DIR/malformed-generics.rs:27:10
+   |
+LL | //! [<Vec<T> 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 5d8dcf8bc1d..ad50887e922 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<x>]
+//! [`empty2<x>`]
diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs
index 42374fdd7ba..e7e3625c078 100644
--- a/src/tools/clippy/clippy_utils/src/lib.rs
+++ b/src/tools/clippy/clippy_utils/src/lib.rs
@@ -2064,9 +2064,9 @@ pub fn fn_def_id(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<DefId> {
     }
 }
 
-/// Returns Option<String> where String is a textual representation of the type encapsulated in the
-/// slice iff the given expression is a slice of primitives (as defined in the
-/// `is_recursively_primitive_type` function) and None otherwise.
+/// Returns `Option<String>` where String is a textual representation of the type encapsulated in
+/// the slice iff the given expression is a slice of primitives (as defined in the
+/// `is_recursively_primitive_type` function) and `None` otherwise.
 pub fn is_slice_of_primitives(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
     let expr_type = cx.typeck_results().expr_ty_adjusted(expr);
     let expr_kind = expr_type.kind();
diff --git a/src/tools/rustfmt/src/config/config_type.rs b/src/tools/rustfmt/src/config/config_type.rs
index e37ed798cb5..c5e61658ad1 100644
--- a/src/tools/rustfmt/src/config/config_type.rs
+++ b/src/tools/rustfmt/src/config/config_type.rs
@@ -4,7 +4,7 @@ use crate::config::options::{IgnoreList, WidthHeuristics};
 /// Trait for types that can be used in `Config`.
 pub(crate) trait ConfigType: Sized {
     /// Returns hint text for use in `Config::print_docs()`. For enum types, this is a
-    /// pipe-separated list of variants; for other types it returns "<type>".
+    /// pipe-separated list of variants; for other types it returns `<type>`.
     fn doc_hint() -> String;
 }