Skip to content

rustdoc does not document Deref impls more than one level deep #53038

Closed
@QuietMisdreavus

Description

@QuietMisdreavus
use std::ops::Deref;

pub struct Base;

impl Base {
    pub fn asdf(&self) {}
}

pub struct LevelOne {
    pub base: Base,
}

impl Deref for LevelOne {
    type Target = Base;

    fn deref(&self) -> &Base {
        &self.base
    }
}

impl LevelOne {
    pub fn qwop(&self) {}
}

pub struct LevelTwo {
    pub base: LevelOne,
}

impl Deref for LevelTwo {
    type Target = LevelOne;

    fn deref(&self) -> &LevelOne {
        &self.base
    }
}

impl LevelTwo {
    pub fn custom() {}
}

In this example, LevelTwo derefs to LevelOne, which derefs to Base. However in the docs, only the methods from LevelOne are shown. We should recursively look for Deref impls on items we're collecting impls for via Deref.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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