Skip to content

Rustdoc "Auto Trait Implementations" is showing private types instead of the relevant generic bounds #162274

Open

Description

@kpreid

Code

pub struct Foo<T>(Bar<T>);

struct Bar<T>(Box<T>);

Or, see a standard library type such as Vec.

Reproduction Steps

  1. cargo doc --open
  2. Visit the "Auto Traits" section of Foo

OR

  1. https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#synthetic-implementations

Expected Outcome

Auto trait implementations should, as they do on stable, show their bounds in terms of the generics of the type.

impl<T> Send for Foo<T>
where
    T: Send,
impl<T, A> Send for Vec<T, A>
where
    A: Send,
    T: Send,

Actual Output

impl<T> Send for Foo<T>
where
    Bar<T>: Send,

Bar is a private type and should not appear in the documentation.

impl<T, A> Send for Vec<T, A>
where
    RawVec<T, A>: Send,

RawVec is a private type and should not appear in the documentation.

This prevents users from understanding what the actual bounds on the impl are, because Bar and RawVec may have bounds that are not the obvious ones.

Version

rustdoc 1.100.0-nightly (2e2b193 2026-09-02)

Does not reproduce on 1.98.0 or 1.99.0-beta.3 (cbae9b4 2026-08-28)

Additional Details

@rustbot label regression-from-stable-to-nightly

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Sep 4, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 4, 2026
  3. added
    A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls
    A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)
    on Sep 4, 2026
  4. fmease commented on Sep 4, 2026

    @fmease
    Member

    This is due to two facts:

    1. We enable the next trait solver for nightly releases (Next-generation trait solver enabled on nightly #160895)
    2. We provide an overly simplistic stand-in auto trait synthesizer if the next trait solver is enabled (Prevent rustdoc auto-trait ICEs with -Znext-solver=globally #158346)

    In the meantime, pass -Znext-solver=coherence to revert to the previous behavior.

  5. self-assigned this
    on Sep 4, 2026
  6. added
    WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 4, 2026
  7. fmease commented on Sep 4, 2026

    @fmease
    Member

    Why can't we just continue to use the current implementation of the auto trait synthesizer when the next solver is enabled? Well, it uses the select API which is no longer supported by the next solver IIRC, it abuses some APIs that are meant to be private IINM & it's generally incredibly janky and painful to look at.

    The actual solution for all of this is my PR #149019 from last year which stalled because I find this feature incredibly nasty to implement and I wasn't funded anymore at the time. Given your report and the fact that I'm funded again, I think I'm morally obliged to pick up this work again (which is fine).

    Of course, there's a semi-tight deadline of probably only a few months until the next trait solver gets stabilized (I don't make any guarantees here, this is hearsay).

  8. fmease commented on Sep 4, 2026

    @fmease
    Member

    However, the current version of PR #149019 is not the final approach & can't be merged as is. lcnr & I discussed a slightly tweaked approach last year that requires some rewriting and retesting.

  9. added
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Sep 4, 2026
  10. added this to the 1.100.0 milestone on Sep 25, 2026
  11. ds84182 commented on Oct 15, 2026

    @ds84182

    Of course, there's a semi-tight deadline of probably only a few months until the next trait solver gets stabilized (I don't make any guarantees here, this is hearsay).

    Christmas is here early: #164209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions