Skip to content

rustdoc: hide inherent impls with private impl items #137596

Open
@lcnr

Description

@lcnr

cc #137576. Rustdoc currently shows inherent impl items even if all impl items are private. This affects BTreeMap:

/// Internal functionality for `BTreeSet`.
impl<K, A: Allocator + Clone> BTreeMap<K, SetValZST, A> {
pub(super) fn replace(&mut self, key: K) -> Option<K>
where
K: Ord,
{
let (map, dormant_map) = DormantMutRef::new(self);
let root_node =
map.root.get_or_insert_with(|| Root::new((*map.alloc).clone())).borrow_mut();
match root_node.search_tree::<K>(&key) {
Found(mut kv) => Some(mem::replace(kv.key_mut(), key)),
GoDown(handle) => {
VacantEntry {
key,
handle: Some(handle),
dormant_map,
alloc: (*map.alloc).clone(),
_marker: PhantomData,
}
.insert(SetValZST);
None
}
}
}

Image of https://doc.rust-lang.org/nightly/std/collections/struct.BTreeMap.html#impl-BTreeMap%3CK,+SetValZST,+A%3E

I feel like the proper fix for this issue is for rustdoc to not show internal inherent impls even if the impl has a doc comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions