From f4e1ffc55e04ecb2e0e4dafa5a430eeeb1990d62 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 6 Nov 2025 18:44:28 +0100 Subject: [PATCH] Add missing documentation --- src/librustdoc/clean/inline.rs | 4 ++++ src/librustdoc/html/format.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 8d1284ca9cb9..6b6c4f9351cc 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -227,6 +227,10 @@ pub(crate) fn item_relative_path(tcx: TyCtxt<'_>, def_id: DefId) -> Vec tcx.def_path(def_id).data.into_iter().filter_map(|elem| elem.data.get_opt_name()).collect() } +/// Get the path to an item in a URL sense: we use it to generate the URL to the actual item. +/// +/// In particular: we handle macro differently: if it's not a macro 2.0 oe a built-in macro, then +/// it is generated at the top-level of the crate and its path will be `[crate_name, macro_name]`. pub(crate) fn get_item_path(tcx: TyCtxt<'_>, def_id: DefId, kind: ItemType) -> Vec { let crate_name = tcx.crate_name(def_id.krate); let relative = item_relative_path(tcx, def_id); diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 181f3e0933ab..1fb450bb1baa 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -410,6 +410,8 @@ fn generate_macro_def_id_path( Ok((url, item_type, fqp)) } +/// If the function succeeded, it will return the full URL to the item, its type and a `Vec` +/// representing its `use` path. fn generate_item_def_id_path( mut def_id: DefId, original_def_id: DefId,