From 1920abdd5635fc45e96e5a5be7a7380afdf6fdc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20D=C3=B6nszelmann?= Date: Thu, 17 Oct 2024 19:11:25 +0200 Subject: [PATCH] fix intra doc links --- compiler/rustc_resolve/src/rustdoc.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index eeade83c57e6..ae6ace624d72 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -205,7 +205,12 @@ pub fn attrs_to_doc_fragments<'a, A: AttributeExt + Clone + 'a>( let (span, kind) = if attr.is_doc_comment() { (attr.span(), DocFragmentKind::SugaredDoc) } else { - (attr.value_span().unwrap(), DocFragmentKind::RawDoc) + ( + attr.value_span() + .map(|i| i.with_ctxt(attr.span().ctxt())) + .unwrap_or(attr.span()), + DocFragmentKind::RawDoc, + ) }; let fragment = DocFragment { span, doc, kind, item_id, indent: 0 }; doc_fragments.push(fragment);