rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.96k stars 12.68k forks source link

`type_name` ICE #61894

Closed quininer closed 5 years ago

quininer commented 5 years ago
struct Bar<M>(M);

impl<M> Bar<M> {
    fn foo(&self) {
        fn f() {}
        fn type_name_of<T>(_: T) -> &'static str {
            unsafe { type_name::<T>() }
        }
        type_name_of(f);
    }
}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=c27b41def12af0276d04e418f0e50b07

I believe this happened after https://github.com/rust-lang/rust/pull/60166.

pnkfelix commented 5 years ago

triage: P-high because it blocks presumed stabilization of type_name (#60066). Removing nomination tag.

eddyb commented 5 years ago

@oli-obk you can have parameterization in scope that's not part of monomorphization (like the M above). For name mangling (with the new scheme) we produce something that demangles to _ in that case. We could use _ in this case too.

eddyb commented 5 years ago

I'm working on a fix that uses _.