Skip to content

Commit 7017133

Browse files
Add missing documentation
1 parent ae76c7b commit 7017133

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ pub(crate) fn item_relative_path(tcx: TyCtxt<'_>, def_id: DefId) -> Vec<Symbol>
227227
tcx.def_path(def_id).data.into_iter().filter_map(|elem| elem.data.get_opt_name()).collect()
228228
}
229229

230+
/// Get the path to an item in a URL sense: we use it to generate the URL to the actual item.
231+
///
232+
/// In particular: we handle macro differently: if it's not a macro 2.0 oe a built-in macro, then
233+
/// it is generated at the top-level of the crate and its path will be `[crate_name, macro_name]`.
230234
pub(crate) fn get_item_path(tcx: TyCtxt<'_>, def_id: DefId, kind: ItemType) -> Vec<Symbol> {
231235
let crate_name = tcx.crate_name(def_id.krate);
232236
let relative = item_relative_path(tcx, def_id);

src/librustdoc/html/format.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ fn generate_macro_def_id_path(
407407
Ok((url, item_type, path))
408408
}
409409

410+
/// If the function succeeded, it will return the full URL to the item, its type and a `Vec`
411+
/// representing its `use` path.
410412
fn generate_item_def_id_path(
411413
mut def_id: DefId,
412414
original_def_id: DefId,

0 commit comments

Comments
 (0)