Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default impls don't substitute type parameters properly in rustdoc #29909

Closed
Manishearth opened this issue Nov 18, 2015 · 1 comment
Closed
Labels
T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Manishearth
Copy link
Member

For example, on http://doc.rust-lang.org/nightly/std/primitive.slice.html, we have

impl<T> Repr<Slice<T>> for [T]
fn repr(&self) -> T

however it should actually be

impl<T> Repr<Slice<T>> for [T]
fn repr(&self) -> Option<T>

since Repr is

pub trait Repr<T> {
    fn repr() -> T { ... }
}

Out of tree example:

pub trait Repr<T> {
   fn repr() -> T {unimplemented!()}
}
pub struct Foo;
impl<T> Repr<Option<T>> for Foo {}

It doesn't even need the type parameter:

pub trait Repr<T> {
   fn repr() -> T {unimplemented!()}
}
pub struct Foo;
impl Repr<u8> for Foo {}

Looks like rustdoc is picking up the signature from the default impl.

@Manishearth Manishearth added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Nov 18, 2015
@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum
Copy link
Member

Closing in favor of #14072 which has more information and discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants