Skip to content

Commit

Permalink
Add some docs to rustdoc::clean::inline and def_id functions
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
  • Loading branch information
tesuji and Joshua Nelson committed Oct 6, 2020
1 parent d890e64 commit 63e7234
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_span/src/def_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ impl DefId {
DefId { krate: LOCAL_CRATE, index }
}

/// Returns whether the item is defined in the crate currently being compiled.
#[inline]
pub fn is_local(self) -> bool {
self.krate == LOCAL_CRATE
Expand Down
3 changes: 3 additions & 0 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,12 @@ pub fn build_ty(cx: &DocContext<'_>, did: DefId) -> Option<clean::Type> {
}
}

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

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

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

0 comments on commit 63e7234

Please sign in to comment.