-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #93569 - notriddle:notriddle/rustdoc-html-tags-generi…
…cs, r=CraftSpider rustdoc: correct unclosed HTML tags as generics CC #67799
- Loading branch information
Showing
7 changed files
with
279 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/rustdoc-ui/suggestions/html-as-generics-no-suggestions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#![deny(rustdoc::invalid_html_tags)] | ||
|
||
/// This Vec<32> thing! | ||
// Numbers aren't valid HTML tags, so no error. | ||
pub struct ConstGeneric; | ||
|
||
/// This Vec<i32, i32> thing! | ||
// HTML tags cannot contain commas, so no error. | ||
pub struct MultipleGenerics; | ||
|
||
/// This Vec<i32 class="test"> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
// HTML attributes shouldn't be treated as Rust syntax, so no suggestions. | ||
pub struct TagWithAttributes; | ||
|
||
/// This Vec<i32></i32> thing! | ||
// There should be no error, and no suggestion, since the tags are balanced. | ||
pub struct DoNotWarnOnMatchingTags; | ||
|
||
/// This Vec</i32> thing! | ||
//~^ERROR unopened HTML tag `i32` | ||
// This should produce an error, but no suggestion. | ||
pub struct EndTagsAreNotValidRustSyntax; | ||
|
||
/// This 123<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
// This should produce an error, but no suggestion. | ||
pub struct NumbersAreNotPaths; | ||
|
||
/// This Vec:<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
// This should produce an error, but no suggestion. | ||
pub struct InvalidTurbofish; | ||
|
||
/// This [link](https://rust-lang.org)<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
// This should produce an error, but no suggestion. | ||
pub struct BareTurbofish; |
38 changes: 38 additions & 0 deletions
38
src/test/rustdoc-ui/suggestions/html-as-generics-no-suggestions.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics-no-suggestions.rs:11:13 | ||
| | ||
LL | /// This Vec<i32 class="test"> thing! | ||
| ^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/html-as-generics-no-suggestions.rs:1:9 | ||
| | ||
LL | #![deny(rustdoc::invalid_html_tags)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unopened HTML tag `i32` | ||
--> $DIR/html-as-generics-no-suggestions.rs:20:13 | ||
| | ||
LL | /// This Vec</i32> thing! | ||
| ^^^^^^ | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics-no-suggestions.rs:25:13 | ||
| | ||
LL | /// This 123<i32> thing! | ||
| ^^^^^ | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics-no-suggestions.rs:30:14 | ||
| | ||
LL | /// This Vec:<i32> thing! | ||
| ^^^^^ | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics-no-suggestions.rs:35:39 | ||
| | ||
LL | /// This [link](https://rust-lang.org)<i32> thing! | ||
| ^^^^^ | ||
|
||
error: aborting due to 5 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// run-rustfix | ||
#![deny(rustdoc::invalid_html_tags)] | ||
|
||
/// This `Vec<i32>` thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct Generic; | ||
|
||
/// This `vec::Vec<i32>` thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct GenericPath; | ||
|
||
/// This `i32<i32>` thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct PathsCanContainTrailingNumbers; | ||
|
||
/// This `Vec::<i32>` thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct Turbofish; | ||
|
||
/// This [link](https://rust-lang.org)`::<i32>` thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct BareTurbofish; | ||
|
||
/// This <span>`Vec::<i32>`</span> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct Nested; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// run-rustfix | ||
#![deny(rustdoc::invalid_html_tags)] | ||
|
||
/// This Vec<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct Generic; | ||
|
||
/// This vec::Vec<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct GenericPath; | ||
|
||
/// This i32<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct PathsCanContainTrailingNumbers; | ||
|
||
/// This Vec::<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct Turbofish; | ||
|
||
/// This [link](https://rust-lang.org)::<i32> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct BareTurbofish; | ||
|
||
/// This <span>Vec::<i32></span> thing! | ||
//~^ERROR unclosed HTML tag `i32` | ||
//~|HELP try marking as source | ||
pub struct Nested; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics.rs:4:13 | ||
| | ||
LL | /// This Vec<i32> 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<i32>` thing! | ||
| + + | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics.rs:9:18 | ||
| | ||
LL | /// This vec::Vec<i32> thing! | ||
| ^^^^^ | ||
| | ||
help: try marking as source code | ||
| | ||
LL | /// This `vec::Vec<i32>` thing! | ||
| + + | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics.rs:14:13 | ||
| | ||
LL | /// This i32<i32> thing! | ||
| ^^^^^ | ||
| | ||
help: try marking as source code | ||
| | ||
LL | /// This `i32<i32>` thing! | ||
| + + | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics.rs:19:15 | ||
| | ||
LL | /// This Vec::<i32> thing! | ||
| ^^^^^ | ||
| | ||
help: try marking as source code | ||
| | ||
LL | /// This `Vec::<i32>` thing! | ||
| + + | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics.rs:24:41 | ||
| | ||
LL | /// This [link](https://rust-lang.org)::<i32> thing! | ||
| ^^^^^ | ||
| | ||
help: try marking as source code | ||
| | ||
LL | /// This [link](https://rust-lang.org)`::<i32>` thing! | ||
| + + | ||
|
||
error: unclosed HTML tag `i32` | ||
--> $DIR/html-as-generics.rs:29:21 | ||
| | ||
LL | /// This <span>Vec::<i32></span> thing! | ||
| ^^^^^ | ||
| | ||
help: try marking as source code | ||
| | ||
LL | /// This <span>`Vec::<i32>`</span> thing! | ||
| + + | ||
|
||
error: aborting due to 6 previous errors | ||
|