diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 8f74a48547d..207c89cbfe8 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -98,7 +98,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { visibility: Inherited, def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id }, kind: box ImplItem(Impl { - span: Span::from_rustc_span(self.cx.tcx.def_span(impl_def_id)), + span: Span::new(self.cx.tcx.def_span(impl_def_id)), unsafety: hir::Unsafety::Normal, generics: ( self.cx.tcx.generics_of(impl_def_id), diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index fd4748f1f50..22e4d21c87b 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1951,14 +1951,6 @@ impl Span { Self(sp.source_callsite()) } - /// Unless you know what you're doing, use [`Self::new`] instead! - /// - /// This function doesn't clean the span at all. Compare with [`Self::new`]'s body to see the - /// difference. - crate fn wrap_raw(sp: rustc_span::Span) -> Span { - Self(sp) - } - crate fn inner(&self) -> rustc_span::Span { self.0 } diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index d1dbfeff876..9364ebc4dcf 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -5,7 +5,6 @@ //! //! Use the `render_with_highlighting` to highlight some rust code. -use crate::clean; use crate::html::escape::Escape; use crate::html::render::Context; @@ -584,7 +583,7 @@ fn string( match href { LinkFromSrc::Local(span) => { context - .href_from_span(clean::Span::wrap_raw(*span)) + .href_from_span(*span) .map(|s| format!("{}{}", context_info.root_path, s)) } LinkFromSrc::External(def_id) => { diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index c7cc2250c24..6a311ac78ab 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -20,7 +20,7 @@ use std::path::{Path, PathBuf}; /// instead of the source code directly. #[derive(Debug)] crate enum LinkFromSrc { - Local(Span), + Local(clean::Span), External(DefId), } @@ -113,7 +113,7 @@ impl<'tcx> SpanMapVisitor<'tcx> { path_span .map(LightSpan::new_from_span) .unwrap_or_else(|| LightSpan::new_from_span(path.span)), - LinkFromSrc::Local(span), + LinkFromSrc::Local(clean::Span::new(span)), ); } else if let Some(def_id) = info { self.matches.insert( @@ -161,7 +161,7 @@ impl Visitor<'tcx> for SpanMapVisitor<'tcx> { Node::Item(item) => { self.matches.insert( LightSpan::new_from_span(item.ident.span), - LinkFromSrc::Local(m.inner), + LinkFromSrc::Local(clean::Span::new(m.inner)), ); } _ => {} @@ -187,7 +187,7 @@ impl Visitor<'tcx> for SpanMapVisitor<'tcx> { Some(span) => { self.matches.insert( LightSpan::new_from_span(method_span), - LinkFromSrc::Local(span), + LinkFromSrc::Local(clean::Span::new(span)), ); } None => {