Closed
Description
all of the following examples result in the same ICE and should imo all be added as test cases once this is fixed:
this one should pass
fn foo<'a: 'a>() -> impl Sized {
let _: () = foo::<'a>();
loop {}
}
this one should error afaik
fn foo<'a: 'a>() -> impl Sized {
let _: *mut &'a () = foo::<'a>();
loop {}
}
this one should pass
fn foo<'a: 'a>() -> impl Sized + 'a {
let _: *mut &'a () = foo::<'a>();
loop {}
}
this one should error
trait Trait<'a, 'b> {}
impl<'a, 'b, T> Trait<'a, 'b> for T {}
fn foo<'a: 'a, 'b: 'b>() -> impl Trait<'a, 'b> {
let _: *mut &'a () = foo::<'a, 'b>();
let _: *mut &'b () = foo::<'a, 'b>();
loop {}
}
they all ICE with
rror: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: opaque type with non-universal region substs
--> src/lib.rs:2:12
|
2 | let _: () = foo::<'a>();
| ^^
|
= note: delayed at compiler/rustc_borrowck/src/region_infer/opaque_types.rs:94:35
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.