Skip to content

ICE: when non-static &str argument is encountered by TypeId #19791

Closed
@Nercury

Description

@Nercury
use std::intrinsics::TypeId;

fn print_type_name<T:'static>(_val: T) {
    println!("{}", TypeId::of::<T>());
}

fn main() {
    print_type_name(|_name: &str| { // allows non 'static &str here
        5i
    });
}
// error: internal compiler error: non-static region found when hashing a type

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions