diff --git a/src/librustdoc/passes/html_tags.rs b/src/librustdoc/passes/html_tags.rs
index 8bb71cef1c7e..1d9be619ec91 100644
--- a/src/librustdoc/passes/html_tags.rs
+++ b/src/librustdoc/passes/html_tags.rs
@@ -142,39 +142,30 @@ fn extract_html_tag(
}
}
-fn extract_html_comment(
- text: &str,
- range: &Range,
- start_pos: usize,
- iter: &mut Peekable>,
- f: &impl Fn(&str, &Range),
-) {
- // We first skip the "!--" part.
- let mut iter = iter.skip(3);
- while let Some((pos, c)) = iter.next() {
- if c == '-' && text[pos..].starts_with("-->") {
- // All good, we can leave!
- return;
- }
- }
- f(
- "Unclosed HTML comment",
- &Range { start: range.start + start_pos, end: range.start + start_pos + 3 },
- );
-}
-
fn extract_tags(
tags: &mut Vec<(String, Range)>,
text: &str,
range: Range,
+ is_in_comment: &mut Option>,
f: &impl Fn(&str, &Range),
) {
let mut iter = text.char_indices().peekable();
while let Some((start_pos, c)) = iter.next() {
- if c == '<' {
+ if is_in_comment.is_some() {
+ if text[start_pos..].starts_with("-->") {
+ *is_in_comment = None;
+ }
+ } else if c == '<' {
if text[start_pos..].starts_with("
pub fn h() {}
+
+/// $DIR/invalid-html-tags.rs:83:5
+ --> $DIR/invalid-html-tags.rs:87:5
|
LL | ///