We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 642e49b commit 74b1eb3Copy full SHA for 74b1eb3
compiler/rustc_resolve/src/rustdoc.rs
@@ -570,7 +570,12 @@ pub fn source_span_for_markdown_range(
570
{
571
// If there is either a match in a previous fragment, or
572
// multiple matches in this fragment, there is ambiguity.
573
- if match_data.is_none() && !snippet[match_start + 1..].contains(pat) {
+ // the snippet cannot be zero-sized,
574
+ // because it matches the pattern,
575
+ // which is checked to not be zero sized.
576
+ if match_data.is_none()
577
+ && !snippet.as_bytes().windows(pat.len()).any(|s| s == pat.as_bytes())
578
+ {
579
match_data = Some((i, match_start));
580
} else {
581
// Heirustic produced ambiguity, return nothing.
0 commit comments