Correctly handle unicode characters and tags being open just before the end of the doc comment

This commit is contained in:
Guillaume Gomez 2020-09-28 11:40:31 +02:00
parent 30cabfd215
commit 5bc148957e
3 changed files with 72 additions and 29 deletions

View file

@ -1,5 +1,8 @@
#![deny(invalid_html_tags)]
//! <p>💩<p>
//~^ ERROR unclosed HTML tag `p`
/// <img><input>
/// <script>
/// <img><input>
@ -38,6 +41,8 @@ pub fn b() {}
//~^ ERROR unclosed HTML tag `div`
/// <h3>
//~^ ERROR unclosed HTML tag `h3`
/// <script
//~^ ERROR unclosed HTML tag `script`
pub fn c() {}
// Unclosed tags shouldn't warn if they are nested inside a <script> elem.
@ -55,7 +60,7 @@ pub fn d() {}
/// <style>
/// <h3><div>
/// </style>
/// <style>
/// <stYle>
/// <div>
/// <p>
/// </div>

View file

@ -1,8 +1,8 @@
error: unclosed HTML tag `unknown`
--> $DIR/invalid-html-tags.rs:7:5
error: unclosed HTML tag `p`
--> $DIR/invalid-html-tags.rs:3:5
|
LL | /// <unknown>
| ^^^^^^^^^
LL | //! <p>💩<p>
| ^^^
|
note: the lint level is defined here
--> $DIR/invalid-html-tags.rs:1:9
@ -10,47 +10,59 @@ note: the lint level is defined here
LL | #![deny(invalid_html_tags)]
| ^^^^^^^^^^^^^^^^^
error: unclosed HTML tag `script`
error: unclosed HTML tag `unknown`
--> $DIR/invalid-html-tags.rs:10:5
|
LL | /// <unknown>
| ^^^^^^^^^
error: unclosed HTML tag `script`
--> $DIR/invalid-html-tags.rs:13:5
|
LL | /// <script>
| ^^^^^^^^
error: unclosed HTML tag `h2`
--> $DIR/invalid-html-tags.rs:15:7
--> $DIR/invalid-html-tags.rs:18:7
|
LL | /// <h2>
| ^^^^
error: unclosed HTML tag `h3`
--> $DIR/invalid-html-tags.rs:17:9
--> $DIR/invalid-html-tags.rs:20:9
|
LL | /// <h3>
| ^^^^
error: unopened HTML tag `hello`
--> $DIR/invalid-html-tags.rs:20:5
--> $DIR/invalid-html-tags.rs:23:5
|
LL | /// </hello>
| ^^^^^^^^
error: unclosed HTML tag `p`
--> $DIR/invalid-html-tags.rs:25:14
--> $DIR/invalid-html-tags.rs:28:14
|
LL | /// <br/> <p>
| ^^^
error: unclosed HTML tag `div`
--> $DIR/invalid-html-tags.rs:37:5
--> $DIR/invalid-html-tags.rs:40:5
|
LL | /// <div style="hello">
| ^^^^
error: unclosed HTML tag `h3`
--> $DIR/invalid-html-tags.rs:39:7
--> $DIR/invalid-html-tags.rs:42:7
|
LL | /// <h3>
| ^^^^
error: aborting due to 8 previous errors
error: unclosed HTML tag `script`
--> $DIR/invalid-html-tags.rs:44:5
|
LL | /// <script
| ^^^^^^
error: aborting due to 10 previous errors