-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE when using anonymization in impl Trait with HRTB #54895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The ICE does only appear when the anonymization uses the lifetime parameter from HRTB. ICE does not occur in all of the following cases: fn f() -> impl for<'a> Trait<'a, Out = impl Sized> { ... }
fn f<'b>() -> impl for<'a> Trait<'a, Out = impl Sized + 'b> { ... }
fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'static> { ... } |
You don't need newtype nor a method in the trait: trait Trait<'a> {
type Out;
}
impl<'a> Trait<'a> for () {
type Out = ();
}
fn main() -> impl for<'a> Trait<'a, Out = impl ?Sized + 'a> {
()
} It is not even need a Furthermore, if fill in the body with the one like in #53420 the error message is this, not the other one. So this error message is closer to the actual defeat. I didn't realized we can have //error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
//fn f1() -> impl FnOnce() -> impl Clone
//OK with #![feature(unboxed_closures)]
fn f2() -> impl FnOnce<(), Output=impl Clone> {...} |
Triage: Still reproduces on current stable and nightly. |
triage: I'm going to leave this as P-high because the ICE message is so inscrutable. (I'd be tempted to downgrade to P-medium if the message included some hint as to how one could work around the bug.) Self-assigning. |
Triage: Still reproduces, cc @matthewjasper @Aaron1011 |
This is a regression since |
Uh oh!
There was an error while loading. Please reload this page.
I tried this code:
It uses the anonymization of associated type inside of impl Trait in return type position.
The compiler reports an ICE as follows:
Meta
rustc --version --verbose
:backtrace:
The text was updated successfully, but these errors were encountered: