doc_lazy_continuation: do not warn on End events

This avoids event spans that would otherwise cause crashes, since an
End's span covers the range of the tag (which will be earlier than the
line break within the tag).
This commit is contained in:
Michael Howell 2024-05-18 14:34:52 -07:00
parent 680256f3ce
commit b5cf8b8277
4 changed files with 97 additions and 2 deletions

View file

@ -750,10 +750,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
Start(_tag) | End(_tag) => (), // We don't care about other tags
SoftBreak | HardBreak => {
if !containers.is_empty()
&& let Some((_next_event, next_range)) = events.peek()
&& let Some((next_event, next_range)) = events.peek()
&& let Some(next_span) = fragments.span(cx, next_range.clone())
&& let Some(span) = fragments.span(cx, range.clone())
&& !in_footnote_definition
&& !matches!(next_event, End(_))
{
lazy_continuation::check(
cx,