Skip to content

Rustdoc: Wrong documentation in case of types that only implement Deref, but not DerefMut #35169

Closed
@Sawyer47

Description

@Sawyer47

Wrong documentation is generated for types that only implement Deref, but not DerefMut. It inherits methods from both Deref and DerefMut.

Steps to reproduce:
cargo new deref-doc-bug

/// lib.rs
pub struct Foo;

impl std::ops::Deref for Foo {
    type Target = [char];
    fn deref(&self) -> &[char] { &[] }
}

cargo doc --open

Generated documentation has methods for both &[char] and &mut [char], for examplefn get_mut.

Version

rustc 1.12.0-nightly (1225e122f 2016-07-30)
rustdoc 1.12.0-nightly (1225e122f 2016-07-30)

Metadata

Metadata

Assignees

No one assigned

    Labels

    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