-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
GATs and min_type_alias_impl_trait cause ICE #87258
Comments
Issue #87218 might be related (or this may be a duplicate of it). |
It was replacing inference lifetimes with concrete ones (but wrong ones, as it was using lifetimes from a completely different item). This avoided certain ICEs and was even correct by accident for the example in the doc comment, but it was just papering over the ICEs causing other examples (where the impl trait is outside the current impl block) to fail. I am looking into this new ICE now |
I am getting
locally before the ICE, so likely the ICE just hides actual errors. Should still fix that of course, but needs more looking into it |
I think you need to use 2018 or 2021 edition. |
minimized and edition-free: #![feature(min_type_alias_impl_trait)]
#![feature(generic_associated_types)]
trait Trait1 {}
struct Struct<'b>(&'b ());
impl<'d> Trait1 for Struct<'d> {}
pub trait Trait2 {
type FooFuture<'a>: Trait1;
fn foo<'a>() -> Self::FooFuture<'a>;
}
impl<'c, S: Trait2> Trait2 for &'c mut S {
type FooFuture<'a> = impl Trait1;
fn foo<'a>() -> Self::FooFuture<'a> {
Struct(unimplemented!())
}
}
fn main() {} The problem is that typeck runs some of old borrowck/regionck and that just can't handle GAT and associated TAIT being used together. While #![feature(min_type_alias_impl_trait)]
#![feature(generic_associated_types)]
trait Trait1 {}
struct Struct<'b>(&'b ());
impl<'d> Trait1 for Struct<'d> {}
pub trait Trait2 {
type FooFuture<'a>: Trait1;
fn foo<'a>() -> Self::FooFuture<'a>;
}
type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
impl<'c, S: Trait2> Trait2 for &'c mut S {
type FooFuture<'a> = Helper<'c, 'a, S>;
fn foo<'a>() -> Self::FooFuture<'a> {
Struct(unimplemented!())
}
}
fn main() {} |
So... turns out this works just fine with nll... I'd say we just wait for that, nll is only blocked on diagnostics, and those are actively being worked on: #86700 |
I've found this does work if adding a It seems to me that Also, how does this work with NLL? I add |
It seems the linked example on the playground does not ICE on the 2021-08-03 nightly. |
@lqd that's with the |
Hum, indeed, the 2 minimized examples Oli mentioned in this comment do ICE with or without |
oof, not sure what I tested here -.- I'll investigate again. But yea, we can just error out instead of ICEing. |
GATs issue triage: not blocking. Fixed; needs test. |
…rk-Simulacrum Add regression test for rust-lang#87258 Closes rust-lang#87258.
…askrgr Rollup of 4 pull requests Successful merges: - rust-lang#90296 (Remove fNN::lerp) - rust-lang#90302 (Remove unneeded into_iter) - rust-lang#90303 (Add regression test for issue 90164) - rust-lang#90305 (Add regression test for rust-lang#87258) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Code
Meta
rustc --version --verbose
:(Also https://play.rust-lang.org/)
Error output
Backtrace
The text was updated successfully, but these errors were encountered: