Skip to content

Commit 54a14e8

Browse files
committed
Remove the last use of the side channel
1 parent fde9453 commit 54a14e8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -827,19 +827,28 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
827827
) -> Option<Res> {
828828
// resolve() can't be used for macro namespace
829829
let result = match ns {
830-
Namespace::MacroNS => self.resolve_macro(path_str, module_id).map_err(ErrorKind::from),
830+
Namespace::MacroNS => self
831+
.resolve_macro(path_str, module_id)
832+
.map(|res| (res, None))
833+
.map_err(ErrorKind::from),
831834
Namespace::TypeNS | Namespace::ValueNS => {
832-
self.resolve(path_str, ns, module_id, extra_fragment).map(|(res, _)| res)
835+
self.resolve(path_str, ns, module_id, extra_fragment)
833836
}
834837
};
835838

836839
let res = match result {
837-
Ok(res) => Some(res),
840+
Ok((res, frag)) => {
841+
if let Some(UrlFragment::Def(_, id)) = frag {
842+
Some(Res::Def(self.cx.tcx.def_kind(id), id))
843+
} else {
844+
Some(res)
845+
}
846+
}
838847
Err(ErrorKind::Resolve(box kind)) => kind.full_res(),
839848
Err(ErrorKind::AnchorFailure(AnchorFailure::RustdocAnchorConflict(res))) => Some(res),
840849
Err(ErrorKind::AnchorFailure(AnchorFailure::MultipleAnchors)) => None,
841850
};
842-
self.kind_side_channel.take().map(|(kind, id)| Res::Def(kind, id)).or(res)
851+
res
843852
}
844853
}
845854

0 commit comments

Comments
 (0)