-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE - trait lifetime polymorphism + associated type #35570
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
cc #36381 |
A related one that fails with get_unique_type_id_of_type in both cases: trait Lifetime<'a> {
type Out;
}
impl<'a> Lifetime<'a> for () {
type Out = &'a ();
}
fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out {
x
}
fn takes_lifetime(f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
}
fn main() {
takes_lifetime(foo);
} Replacing the explicit fn() with a desired F: for<'a> FnOnce... gives the problematic errors reported in #34430 (at least it doesn't ICE in that case!). Also apparently this is a regression somewhat, as it doesn't crash on 1.10 (and https://is.gd/NOhNNU doesn't error, etc) (this was incorrect, I was testing the wrong variant of the code) |
Neither example ICEs today. E-needstest. |
Add tests for a few issues. Fixes rust-lang#41998 Fixes rust-lang#38381 Fixes rust-lang#37515 Fixes rust-lang#37510 Fixes rust-lang#37508 Fixes rust-lang#37366 Fixes rust-lang#37323 Fixes rust-lang#37051 Fixes rust-lang#36839 Fixes rust-lang#35570 Fixes rust-lang#34373 Fixes rust-lang#34222 Certainly not all of the E-needstest issues right now, but I started to get bored.
Uh oh!
There was an error while loading. Please reload this page.
stable:
error: internal compiler error: ../src/librustc_trans/debuginfo/metadata.rs:306: get_unique_type_id_of_type() - unexpected type: <() as Trait2<'static>>::Ty
nightly:
thread 'rustc' panicked at 'assertion failed: ty.is_normalized_for_trans()', ../src/librustc_trans/collector.rs:534
The stable version's ICE error message also appears in nightly if I write a transmute inside ice():
(This came up while trying to find ways to convince Rust that two complicated type expressions are the same type. I got this ICE, simplified here.)
The text was updated successfully, but these errors were encountered: