Skip to content

Commit 63e7234

Browse files
tesujiJoshua Nelson
and
Joshua Nelson
committed
Add some docs to rustdoc::clean::inline and def_id functions
Co-authored-by: Joshua Nelson <[email protected]>
1 parent d890e64 commit 63e7234

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

compiler/rustc_span/src/def_id.rs

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ impl DefId {
159159
DefId { krate: LOCAL_CRATE, index }
160160
}
161161

162+
/// Returns whether the item is defined in the crate currently being compiled.
162163
#[inline]
163164
pub fn is_local(self) -> bool {
164165
self.krate == LOCAL_CRATE

src/librustdoc/clean/inline.rs

+3
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,12 @@ pub fn build_ty(cx: &DocContext<'_>, did: DefId) -> Option<clean::Type> {
290290
}
291291
}
292292

293+
/// Builds all inherent implementations of an ADT (struct/union/enum) or Trait item/path/reexport.
293294
pub fn build_impls(cx: &DocContext<'_>, did: DefId, attrs: Option<Attrs<'_>>) -> Vec<clean::Item> {
294295
let tcx = cx.tcx;
295296
let mut impls = Vec::new();
296297

298+
// for each implementation of an item represented by `did`, build the clean::Item for that impl
297299
for &did in tcx.inherent_impls(did).iter() {
298300
build_impl(cx, did, attrs, &mut impls);
299301
}
@@ -320,6 +322,7 @@ fn merge_attrs(
320322
merged_attrs.clean(cx)
321323
}
322324

325+
/// Builds a specific implementation of a type. The `did` could be a type method or trait method.
323326
pub fn build_impl(
324327
cx: &DocContext<'_>,
325328
did: DefId,

0 commit comments

Comments
 (0)