From 1064003f8c39e138c3fefa9104fd74ffe81df3e8 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Wed, 5 Jan 2022 18:12:26 -0800 Subject: [PATCH] Use fragment instead of side channel for prim. assoc. items I had the epiphany that now that fragments are "semantic" -- rather than just strings -- they fill the role that used to be handled by the side channel. I think I may be able to get rid of the other uses of the side channel using this technique too. --- src/librustdoc/passes/collect_intra_doc_links.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index ddb9f53c695..fe390f6354c 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1353,7 +1353,9 @@ impl LinkCollector<'_, '_> { match res { Res::Primitive(prim) => { - if let Some((kind, id)) = self.kind_side_channel.take() { + if let Some(UrlFragment::Def(_, id)) = fragment { + let kind = self.cx.tcx.def_kind(id); + // We're actually resolving an associated item of a primitive, so we need to // verify the disambiguator (if any) matches the type of the associated item. // This case should really follow the same flow as the `Res::Def` branch below,