Skip to content

rustdoc should show methods accessible by more than one deref #26207

Closed
@japaric

Description

@japaric

STR

use std::ops::Deref;

pub struct Foo(Bar);

pub struct Bar(Baz);

pub struct Baz;

impl Deref for Foo {
    type Target = Bar;

    fn deref(&self) -> &Bar { &self.0 }
}

impl Deref for Bar {
    type Target = Baz;

    fn deref(&self) -> &Baz { &self.0 }
}

impl Bar {
    /// This appears under `Foo` methods
    pub fn shows_up(&self) {}
}

impl Baz {
    /// But this doesn't, because it requires `deref`ing `Foo` twice
    pub fn doesnt_show_up(&self) {}
}

fn test(foo: Foo) {
    // Even though both methods are accessible via `Foo`
    foo.shows_up();
    foo.doesnt_show_up();
}

fn main() {}

20150510234554

Version

rustc 1.2.0-nightly (613e57b44 2015-06-01) (built 2015-06-02)

cc @alexcrichton

Metadata

Metadata

Assignees

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