Skip to content

Cross-crate re-export produces invalid rustdoc for impl Trait #62779

Closed
@fatemender

Description

@fatemender

In a cross-crate reexport of an impl Trait-accepting function, rustdoc formats it in a wrong way which is not even valid Rust.

Let crate1 be:

pub trait MyTrait {}
pub fn accepts_impl(_t: impl MyTrait) {}

Let crate2 be:

pub use crate1::{MyTrait, accepts_impl};

If we generate docs for crate2, we get this definition for the (re-exported) accepts_impl:

pub fn accepts_impl<impl MyTrait>(_t: impl MyTrait) 
where
    impl MyTrait: MyTrait, 

I see some similarities with #60113 here.
Both issues still reproduce on stable 1.36.0 and nightly bc2e84c.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-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