Skip to content

Commit f233a70

Browse files
Use rustdoc Span in LinkFromSrc directly
1 parent dffc9c0 commit f233a70

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

src/librustdoc/clean/blanket_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
9898
visibility: Inherited,
9999
def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id },
100100
kind: box ImplItem(Impl {
101-
span: Span::from_rustc_span(self.cx.tcx.def_span(impl_def_id)),
101+
span: Span::new(self.cx.tcx.def_span(impl_def_id)),
102102
unsafety: hir::Unsafety::Normal,
103103
generics: (
104104
self.cx.tcx.generics_of(impl_def_id),

src/librustdoc/clean/types.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,14 +1951,6 @@ impl Span {
19511951
Self(sp.source_callsite())
19521952
}
19531953

1954-
/// Unless you know what you're doing, use [`Self::new`] instead!
1955-
///
1956-
/// This function doesn't clean the span at all. Compare with [`Self::new`]'s body to see the
1957-
/// difference.
1958-
crate fn wrap_raw(sp: rustc_span::Span) -> Span {
1959-
Self(sp)
1960-
}
1961-
19621954
crate fn inner(&self) -> rustc_span::Span {
19631955
self.0
19641956
}

src/librustdoc/html/highlight.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//!
66
//! Use the `render_with_highlighting` to highlight some rust code.
77
8-
use crate::clean;
98
use crate::html::escape::Escape;
109
use crate::html::render::Context;
1110

@@ -584,7 +583,7 @@ fn string<T: Display>(
584583
match href {
585584
LinkFromSrc::Local(span) => {
586585
context
587-
.href_from_span(clean::Span::wrap_raw(*span))
586+
.href_from_span(*span)
588587
.map(|s| format!("{}{}", context_info.root_path, s))
589588
}
590589
LinkFromSrc::External(def_id) => {

src/librustdoc/html/render/span_map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::path::{Path, PathBuf};
2020
/// instead of the source code directly.
2121
#[derive(Debug)]
2222
crate enum LinkFromSrc {
23-
Local(Span),
23+
Local(clean::Span),
2424
External(DefId),
2525
}
2626

@@ -113,7 +113,7 @@ impl<'tcx> SpanMapVisitor<'tcx> {
113113
path_span
114114
.map(LightSpan::new_from_span)
115115
.unwrap_or_else(|| LightSpan::new_from_span(path.span)),
116-
LinkFromSrc::Local(span),
116+
LinkFromSrc::Local(clean::Span::new(span)),
117117
);
118118
} else if let Some(def_id) = info {
119119
self.matches.insert(
@@ -161,7 +161,7 @@ impl Visitor<'tcx> for SpanMapVisitor<'tcx> {
161161
Node::Item(item) => {
162162
self.matches.insert(
163163
LightSpan::new_from_span(item.ident.span),
164-
LinkFromSrc::Local(m.inner),
164+
LinkFromSrc::Local(clean::Span::new(m.inner)),
165165
);
166166
}
167167
_ => {}
@@ -187,7 +187,7 @@ impl Visitor<'tcx> for SpanMapVisitor<'tcx> {
187187
Some(span) => {
188188
self.matches.insert(
189189
LightSpan::new_from_span(method_span),
190-
LinkFromSrc::Local(span),
190+
LinkFromSrc::Local(clean::Span::new(span)),
191191
);
192192
}
193193
None => {

0 commit comments

Comments
 (0)