Skip to content

Rustdoc: the Sized bound on traits isn't shown #82581

Closed
@InnocentusLime

Description

@InnocentusLime

rustdoc doesn't show that some traits require the type to be sized, which can get a bit misleading.

For example, the docs for std::default::Default (https://doc.rust-lang.org/std/default/trait.Default.html) show

pub trait Default {
    pub fn default() -> Self;
}

While in reality it is actually

pub trait Default: Sized {
    /* Docs and stabilization attributes */
    fn default() -> Self;
}

When looking at a trait definition, rust assumes that the type the trait will be implemented for is ?Sized, so dropping Sized is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-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