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

Rustdoc makes trait bounds with associated types overly verbose #102142

Closed
JoJoJet opened this issue Sep 22, 2022 · 3 comments · Fixed by #102439
Closed

Rustdoc makes trait bounds with associated types overly verbose #102142

JoJoJet opened this issue Sep 22, 2022 · 3 comments · Fixed by #102439
Assignees
Labels
A-associated-items Area: Associated items (types, constants & functions) A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@JoJoJet
Copy link
Contributor

JoJoJet commented Sep 22, 2022

Location

https://doc.rust-lang.org/std/future/trait.IntoFuture.html

https://doc.rust-lang.org/std/iter/trait.IntoIterator.html

Summary

The definition of the IntoFuture trait looks like:

pub trait IntoFuture {
    type Output;
    type IntoFuture: Future<Output = Self::Output>;
    fn into_future(self) -> Self::IntoFuture;
}

Rustdoc renders this as:

pub trait IntoFuture {
    type Output;
    type IntoFuture: Future
    where
        <Self::IntoFuture as Future>::Output == Self::Output;
    fn into_future(self) -> Self::IntoFuture;
}

This makes the trait bound for the IntoFuture associated type verbose and cryptic.

@JoJoJet JoJoJet added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Sep 22, 2022
@fmease
Copy link
Member

fmease commented Sep 22, 2022

@rustbot label -A-docs C-bug T-rustdoc A-rustdoc-ui A-associated-items

@rustbot rustbot added A-associated-items Area: Associated items (types, constants & functions) A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Sep 22, 2022
@fmease
Copy link
Member

fmease commented Sep 22, 2022

I did a quick investigation: This reproduces on stable and nightly but only if the corresponding trait comes from an extern crate (which is the case with std & core). Thus marking this issue as
@rustbot label A-cross-crate-reexports

Minimal reproducer:

// rustc one.rs --crate-type=lib
pub trait Future {
    type Output;
}

pub trait IntoFuture {
    type Output;
    type IntoFuture: Future<Output = Self::Output>;
}
// rustdoc two.rs --extern=one=libone.rlib --edition=2021
pub use one::IntoFuture;

@rustbot claim

@rustbot rustbot added the A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate label Sep 22, 2022
@fmease
Copy link
Member

fmease commented Sep 22, 2022

Highly related to / “duplicate” of #84579 although the latter is quite outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate A-rustdoc-ui Area: Rustdoc UI (generated HTML) 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

Successfully merging a pull request may close this issue.

3 participants