Skip to content

Commit e13d7d9

Browse files
authored
Rollup merge of rust-lang#144334 - lolbinarycat:rustdoc-span_of_fragments-revert, r=GuillaumeGomez
rustc_resolve: get rid of unused rustdoc::span_of_fragments_with_expansion This function can cause false negatives if used incorrectly (usually "do any of the doc fragments come from a macro" is the wrong question to ask), and thus it is unused. r? `@GuillaumeGomez`
2 parents 3d6e834 + 95de0aa commit e13d7d9

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

compiler/rustc_resolve/src/rustdoc.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,8 @@ fn collect_link_data<'input, F: BrokenLinkCallback<'input>>(
509509
display_text.map(String::into_boxed_str)
510510
}
511511

512-
/// Returns a tuple containing a span encompassing all the document fragments and a boolean that is
513-
/// `true` if any of the fragments are from a macro expansion.
514-
pub fn span_of_fragments_with_expansion(fragments: &[DocFragment]) -> Option<(Span, bool)> {
512+
/// Returns a span encompassing all the document fragments.
513+
pub fn span_of_fragments(fragments: &[DocFragment]) -> Option<Span> {
515514
let (first_fragment, last_fragment) = match fragments {
516515
[] => return None,
517516
[first, .., last] => (first, last),
@@ -520,15 +519,7 @@ pub fn span_of_fragments_with_expansion(fragments: &[DocFragment]) -> Option<(Sp
520519
if first_fragment.span == DUMMY_SP {
521520
return None;
522521
}
523-
Some((
524-
first_fragment.span.to(last_fragment.span),
525-
fragments.iter().any(|frag| frag.from_expansion),
526-
))
527-
}
528-
529-
/// Returns a span encompassing all the document fragments.
530-
pub fn span_of_fragments(fragments: &[DocFragment]) -> Option<Span> {
531-
span_of_fragments_with_expansion(fragments).map(|(sp, _)| sp)
522+
Some(first_fragment.span.to(last_fragment.span))
532523
}
533524

534525
/// Attempts to match a range of bytes from parsed markdown to a `Span` in the source code.
@@ -686,7 +677,7 @@ pub fn source_span_for_markdown_range_inner(
686677
}
687678
}
688679

689-
let (span, _) = span_of_fragments_with_expansion(fragments)?;
680+
let span = span_of_fragments(fragments)?;
690681
let src_span = span.from_inner(InnerSpan::new(
691682
md_range.start + start_bytes,
692683
md_range.end + start_bytes + end_bytes,

0 commit comments

Comments
 (0)