Skip to content

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

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

Closed
InnocentusLime opened this issue Feb 27, 2021 · 1 comment
Closed

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

InnocentusLime opened this issue Feb 27, 2021 · 1 comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@InnocentusLime
Copy link

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.

@GuillaumeGomez GuillaumeGomez added A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 27, 2021
@camelid camelid added C-bug Category: This is a bug. A-trait-system Area: Trait system and removed A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Mar 3, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 30, 2021

Duplicate of #24183.

@jyn514 jyn514 closed this as completed Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. 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

4 participants