Skip to content

rustdoc: Self: Sized bounds in different crates are pruned #24183

New issue

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

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

Already on GitHub? # to your account

Closed
alexcrichton opened this issue Apr 8, 2015 · 8 comments · Fixed by #78181 or #103254
Closed

rustdoc: Self: Sized bounds in different crates are pruned #24183

alexcrichton opened this issue Apr 8, 2015 · 8 comments · Fixed by #78181 or #103254
Assignees
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

alexcrichton commented Apr 8, 2015

For example Iterator::map should have a Self: Sized bound, but we're a little too aggressive about pruning out the Sized bounds.

For comparison core::iter::Iterator::map does indeed have the bound.

@alexcrichton alexcrichton added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 8, 2015
@apasel422
Copy link
Contributor

This also applies to Sized bounds on traits.

@crumblingstatue
Copy link
Contributor

This prompted a question on IRC about whether Clone requires Sized, because the Sized bound is not visible in the libstd documentation. It is visible in the libcore docs though.

@jonas-schievink
Copy link
Contributor

Triage: This still happens

@jyn514 jyn514 added the A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate label Dec 16, 2020
@jyn514 jyn514 changed the title rustdoc: Self: Sized bounds are pruned rustdoc: Self: Sized bounds in different crates are pruned Dec 16, 2020
@guswynn
Copy link
Contributor

guswynn commented Jan 28, 2021

This actually ended up biting me today, is there a plan to handle this? I could help implement if I get pointers

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 19, 2021
Add Sized trait display when implemented on type

Fixes rust-lang#24183.

I'm not too happy about the hack I had to add in here, however, it seems like the `Sized` trait is **very** special.

cc `@jyn514`
r? `@ollie27`
@bors bors closed this as completed in b75baad Feb 20, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 30, 2021

@GuillaumeGomez #78181 did not fix this - it now shows impl !Sized for dyn Trait, which is nice, but it doesn't show Self: Sized bounds on traits. For traits it does matter because the default is ?Sized.

@jyn514
Copy link
Member

jyn514 commented Mar 30, 2021

This actually ended up biting me today, is there a plan to handle this? I could help implement if I get pointers

@guswynn I would start by finding out why this is different between local crates and cross-crate re-exports. I expect impl Clean<Item> for hir::TraitItem<'_> is behaving differently from impl Clean<Type> for (ty::TraitRef<'_>, &[TypeBinding]).

@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
@tmandry
Copy link
Member

tmandry commented Apr 14, 2022

Ah, I also hit this today when looking at Clone. Kudos to whoever can figure this one out :)

@fmease
Copy link
Member

fmease commented Oct 18, 2022

@rustbot claim

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 23, 2022
rustdoc: do not filter out cross-crate `Self: Sized` bounds

All type parameters **except `Self`** are implicitly `Sized` ([via](https://doc.rust-lang.org/nightly/std/marker/trait.Sized.html)). Previously, we disregarded the exception of `Self` and omitted cross-crate `Sized` bounds of *any* type parameter *including* `Self` when rendering.
From now on, we *do* render cross-crate `Self: Sized` bounds.

Most notably, in `std` we now finally properly render the `Sized` bound of the `Clone` trait as well as the `Self: Sized` bound on `Iterator::map`.

Fixes rust-lang#24183.

`@rustbot` label T-rustdoc A-cross-crate-reexports
r? rustdoc
@bors bors closed this as completed in 28a1baf Oct 24, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate 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