From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../suggestions/html-as-generics-no-suggestions.rs | 80 +++++++++ .../html-as-generics-no-suggestions.stderr | 68 ++++++++ .../rustdoc-ui/suggestions/html-as-generics.fixed | 82 +++++++++ tests/rustdoc-ui/suggestions/html-as-generics.rs | 82 +++++++++ .../rustdoc-ui/suggestions/html-as-generics.stderr | 183 +++++++++++++++++++++ 5 files changed, 495 insertions(+) create mode 100644 tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.rs create mode 100644 tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.stderr create mode 100644 tests/rustdoc-ui/suggestions/html-as-generics.fixed create mode 100644 tests/rustdoc-ui/suggestions/html-as-generics.rs create mode 100644 tests/rustdoc-ui/suggestions/html-as-generics.stderr (limited to 'tests/rustdoc-ui/suggestions') diff --git a/tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.rs b/tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.rs new file mode 100644 index 000000000..476e3b2d4 --- /dev/null +++ b/tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.rs @@ -0,0 +1,80 @@ +#![deny(rustdoc::invalid_html_tags)] + +/// This Vec<32> thing! +// Numbers aren't valid HTML tags, so no error. +pub struct ConstGeneric; + +/// This Vec thing! +// HTML tags cannot contain commas, so no error. +pub struct MultipleGenerics; + +/// This <[u32] as Iterator> thing! +//~^ERROR unclosed HTML tag `Item` +// Some forms of fully-qualified path are simultaneously valid HTML tags +// with attributes. They produce an error, but no suggestion, because figuring +// out if this is valid would require parsing the entire path grammar. +// +// The important part is that we don't produce any *wrong* suggestions. +// While several other examples below are added to make sure we don't +// produce suggestions when given complex paths, this example is the actual +// reason behind not just using the real path parser. It's ambiguous: there's +// no way to locally reason out whether that `[u32]` is intended to be a slice +// or an intra-doc link. +pub struct FullyQualifiedPathsDoNotCount; + +/// This ::Iter thing! +//~^ERROR unclosed HTML tag `Vec` +// Some forms of fully-qualified path are simultaneously valid HTML tags +// with attributes. They produce an error, but no suggestion, because figuring +// out if this is valid would require parsing the entire path grammar. +pub struct FullyQualifiedPathsDoNotCount1; + +/// This Vec::Iter thing! +//~^ERROR unclosed HTML tag `Vec` +// Some forms of fully-qualified path are simultaneously valid HTML tags +// with attributes. They produce an error, but no suggestion, because figuring +// out if this is valid would require parsing the entire path grammar. +pub struct FullyQualifiedPathsDoNotCount2; + +/// This Vec thing! +//~^ERROR unclosed HTML tag `Vec` +// Some forms of fully-qualified path are simultaneously valid HTML tags +// with attributes. They produce an error, but no suggestion, because figuring +// out if this is valid would require parsing the entire path grammar. +pub struct FullyQualifiedPathsDoNotCount3; + +/// This Vec as IntoIter> thing! +//~^ERROR unclosed HTML tag `i32` +// Some forms of fully-qualified path are simultaneously valid HTML tags +// with attributes. They produce an error, but no suggestion, because figuring +// out if this is valid would require parsing the entire path grammar. +pub struct FullyQualifiedPathsDoNotCount4; + +/// This Vec thing! +//~^ERROR unclosed HTML tag `i32` +// HTML attributes shouldn't be treated as Rust syntax, so no suggestions. +pub struct TagWithAttributes; + +/// This Vec thing! +// There should be no error, and no suggestion, since the tags are balanced. +pub struct DoNotWarnOnMatchingTags; + +/// This Vec thing! +//~^ERROR unopened HTML tag `i32` +// This should produce an error, but no suggestion. +pub struct EndTagsAreNotValidRustSyntax; + +/// This 123 thing! +//~^ERROR unclosed HTML tag `i32` +// This should produce an error, but no suggestion. +pub struct NumbersAreNotPaths; + +/// This Vec: thing! +//~^ERROR unclosed HTML tag `i32` +// This should produce an error, but no suggestion. +pub struct InvalidTurbofish; + +/// This [link](https://rust-lang.org) thing! +//~^ERROR unclosed HTML tag `i32` +// This should produce an error, but no suggestion. +pub struct BareTurbofish; diff --git a/tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.stderr b/tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.stderr new file mode 100644 index 000000000..3856a2513 --- /dev/null +++ b/tests/rustdoc-ui/suggestions/html-as-generics-no-suggestions.stderr @@ -0,0 +1,68 @@ +error: unclosed HTML tag `Item` + --> $DIR/html-as-generics-no-suggestions.rs:11:28 + | +LL | /// This <[u32] as Iterator> thing! + | ^^^^^^ + | +note: the lint level is defined here + --> $DIR/html-as-generics-no-suggestions.rs:1:9 + | +LL | #![deny(rustdoc::invalid_html_tags)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unclosed HTML tag `Vec` + --> $DIR/html-as-generics-no-suggestions.rs:25:10 + | +LL | /// This ::Iter thing! + | ^^^^ + +error: unclosed HTML tag `Vec` + --> $DIR/html-as-generics-no-suggestions.rs:32:13 + | +LL | /// This Vec::Iter thing! + | ^^^^ + +error: unclosed HTML tag `Vec` + --> $DIR/html-as-generics-no-suggestions.rs:39:13 + | +LL | /// This Vec thing! + | ^^^^ + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics-no-suggestions.rs:46:17 + | +LL | /// This Vec as IntoIter> thing! + | ^^^^^ + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics-no-suggestions.rs:53:13 + | +LL | /// This Vec thing! + | ^^^^ + +error: unopened HTML tag `i32` + --> $DIR/html-as-generics-no-suggestions.rs:62:13 + | +LL | /// This Vec thing! + | ^^^^^^ + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics-no-suggestions.rs:67:13 + | +LL | /// This 123 thing! + | ^^^^^ + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics-no-suggestions.rs:72:14 + | +LL | /// This Vec: thing! + | ^^^^^ + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics-no-suggestions.rs:77:39 + | +LL | /// This [link](https://rust-lang.org) thing! + | ^^^^^ + +error: aborting due to 10 previous errors + diff --git a/tests/rustdoc-ui/suggestions/html-as-generics.fixed b/tests/rustdoc-ui/suggestions/html-as-generics.fixed new file mode 100644 index 000000000..003542d38 --- /dev/null +++ b/tests/rustdoc-ui/suggestions/html-as-generics.fixed @@ -0,0 +1,82 @@ +// run-rustfix +#![deny(rustdoc::invalid_html_tags)] + +/// This `Vec` thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct Generic; + +/// This `vec::Vec` thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct GenericPath; + +/// This `i32` thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct PathsCanContainTrailingNumbers; + +/// This `Vec::` thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct Turbofish; + +/// This [link](https://rust-lang.org)`::` thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct BareTurbofish; + +/// This `Vec::` thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct Nested; + +/// Nested generics `Vec>` +//~^ ERROR unclosed HTML tag `u32` +//~|HELP try marking as source +pub struct NestedGenerics; + +/// Generics with path `Vec::Iter` +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct GenericsWithPath; + +/// Generics with path `>::Iter` +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPath; + +/// Generics with path `Vec>::Iter` +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPath2; + +/// Generics with bump `>`s +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithBump; + +/// Generics with bump `Vec>`s +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithBump2; + +/// Generics with punct `>`! +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPunct; + +/// Generics with punct `Vec>`! +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPunct2; + +/// This [`Vec`] thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct IntraDocLink; + +/// This [`Vec::`] thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct IntraDocLinkTurbofish; diff --git a/tests/rustdoc-ui/suggestions/html-as-generics.rs b/tests/rustdoc-ui/suggestions/html-as-generics.rs new file mode 100644 index 000000000..4254a660b --- /dev/null +++ b/tests/rustdoc-ui/suggestions/html-as-generics.rs @@ -0,0 +1,82 @@ +// run-rustfix +#![deny(rustdoc::invalid_html_tags)] + +/// This Vec thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct Generic; + +/// This vec::Vec thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct GenericPath; + +/// This i32 thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct PathsCanContainTrailingNumbers; + +/// This Vec:: thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct Turbofish; + +/// This [link](https://rust-lang.org):: thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct BareTurbofish; + +/// This Vec:: thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct Nested; + +/// Nested generics Vec> +//~^ ERROR unclosed HTML tag `u32` +//~|HELP try marking as source +pub struct NestedGenerics; + +/// Generics with path Vec::Iter +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct GenericsWithPath; + +/// Generics with path >::Iter +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPath; + +/// Generics with path Vec>::Iter +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPath2; + +/// Generics with bump >s +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithBump; + +/// Generics with bump Vec>s +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithBump2; + +/// Generics with punct >! +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPunct; + +/// Generics with punct Vec>! +//~^ ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct NestedGenericsWithPunct2; + +/// This [Vec] thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct IntraDocLink; + +/// This [Vec::] thing! +//~^ERROR unclosed HTML tag `i32` +//~|HELP try marking as source +pub struct IntraDocLinkTurbofish; diff --git a/tests/rustdoc-ui/suggestions/html-as-generics.stderr b/tests/rustdoc-ui/suggestions/html-as-generics.stderr new file mode 100644 index 000000000..481278bda --- /dev/null +++ b/tests/rustdoc-ui/suggestions/html-as-generics.stderr @@ -0,0 +1,183 @@ +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:4:13 + | +LL | /// This Vec thing! + | ^^^^^ + | +note: the lint level is defined here + --> $DIR/html-as-generics.rs:2:9 + | +LL | #![deny(rustdoc::invalid_html_tags)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try marking as source code + | +LL | /// This `Vec` thing! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:9:18 + | +LL | /// This vec::Vec thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This `vec::Vec` thing! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:14:13 + | +LL | /// This i32 thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This `i32` thing! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:19:15 + | +LL | /// This Vec:: thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This `Vec::` thing! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:24:41 + | +LL | /// This [link](https://rust-lang.org):: thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This [link](https://rust-lang.org)`::` thing! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:29:21 + | +LL | /// This Vec:: thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This `Vec::` thing! + | + + + +error: unclosed HTML tag `u32` + --> $DIR/html-as-generics.rs:34:28 + | +LL | /// Nested generics Vec> + | ^^^^^ + | +help: try marking as source code + | +LL | /// Nested generics `Vec>` + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:39:27 + | +LL | /// Generics with path Vec::Iter + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with path `Vec::Iter` + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:44:28 + | +LL | /// Generics with path >::Iter + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with path `>::Iter` + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:49:31 + | +LL | /// Generics with path Vec>::Iter + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with path `Vec>::Iter` + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:54:28 + | +LL | /// Generics with bump >s + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with bump `>`s + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:59:31 + | +LL | /// Generics with bump Vec>s + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with bump `Vec>`s + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:64:29 + | +LL | /// Generics with punct >! + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with punct `>`! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:69:32 + | +LL | /// Generics with punct Vec>! + | ^^^^^ + | +help: try marking as source code + | +LL | /// Generics with punct `Vec>`! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:74:14 + | +LL | /// This [Vec] thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This [`Vec`] thing! + | + + + +error: unclosed HTML tag `i32` + --> $DIR/html-as-generics.rs:79:16 + | +LL | /// This [Vec::] thing! + | ^^^^^ + | +help: try marking as source code + | +LL | /// This [`Vec::`] thing! + | + + + +error: aborting due to 16 previous errors + -- cgit v1.2.3