Skip to content

Rustdoc shows broken anonymous lifetimes on re-exported signatures #98697

Closed
@dtolnay

Description

@dtolnay
# Cargo.toml

[package]
name = "repro"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
foo = { path = "foo" }
// src/lib.rs

pub use foo::repro;
# foo/Cargo.toml

[package]
name = "foo"
version = "0.0.0"
edition = "2021"
publish = false
// foo/src/lib.rs

pub fn repro<F>()
where
    F: Fn(&str),
{
    unimplemented!()
}

The correct behavior is for both crates' docs to render repro as:

However, recent versions of nightly rustdoc render foo::repro as the above, while rendering repro::repro incorrectly as:

I believe this is a bug because that is not valid syntax in Rust.

error[E0637]: `'_` cannot be used here
 --> src/lib.rs:3:12
  |
3 |     F: for<'_> Fn(&str),
  |            ^^ `'_` is a reserved lifetime name

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions