Skip to content

Butchered std::any::type_name output for trait object types with lifetime params #145168

@fmease

Description

@fmease

Reproducer:

fn main() {
    trait Trait<'a, T> {}
    dbg!(std::any::type_name::<dyn Trait<'_, ()>>()); // yields `"dyn playground::main::Trait<, ()>"`
                                                      // notice the "bad comma"
}

Marked T-libs for obvious reasons but this is actually something that needs to be fixed in the compiler.

Earlier Zulip discussion: #t-compiler > `type_name` omits lifetimes?.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dyn-traitArea: trait objects, vtable layoutA-lifetimesArea: Lifetimes / regionsA-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library 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