Show deref's target methods, even if target is `doc(hidden)`

Given such example:

#[doc(hidden)]
pub struct Impl;

impl Impl {
    pub fn foo(&self);
}

pub struct ActuallyPublic {
    inner: Impl,
}

impl Deref for ActuallyPublic {
    type Target = Impl;

    fn deref(&self) -> &Impl {
        &self.inner
    }
}

currently ActuallyPublic::foo doesn't shows up in docs (as a deref target method).

Would it make sense to show it? It is accessible, and it isn't marked with doc(hidden).

Alternatively, would it be better to add doc(show_in_deref), allowing to explicitly mark method?

Do you have a situation in mind where you would want this?

Off the top of my head, I can't think of any situation where you'd want to have a Deref target that is hidden when the ActuallyPublic struct isn't hidden. #[doc(hidden)] is generally for things that are logically implementation details but can't avoid being public for technical reasons (e.g. because they are used in macros); in that situation, I would expect that you wouldn't want to use Deref in the first place.

3 Likes