r.end += 1;
}
if is_closing {
+ // In case we have "</div >" or even "</div >".
+ if c != '>' {
+ if !c.is_whitespace() {
+ // It seems like it's not a valid HTML tag.
+ break;
+ }
+ let mut found = false;
+ for (new_pos, c) in text[pos..].char_indices() {
+ if !c.is_whitespace() {
+ if c == '>' {
+ r.end = range.start + new_pos + 1;
+ found = true;
+ }
+ break;
+ }
+ }
+ if !found {
+ break;
+ }
+ }
drop_tag(tags, tag_name, r, f);
} else {
tags.push((tag_name, r));
/// </h1>
/// </hello>
//~^ ERROR unopened HTML tag `hello`
-pub fn f() {}
+pub fn bar() {}
/// <div>
/// <br/> <p>
/// </div>
/// </style>
pub fn e() {}
+
+// Closing tags need to have ">" at the end, otherwise it's not a closing tag!
+/// <div></div >
+/// <div></div
+//~^ ERROR unclosed HTML tag `div`
+pub fn f() {}
LL | /// <script
| ^^^^^^
-error: aborting due to 11 previous errors
+error: unclosed HTML tag `div`
+ --> $DIR/invalid-html-tags.rs:73:5
+ |
+LL | /// <div></div
+ | ^^^^^
+
+error: aborting due to 12 previous errors