Change:
: (Also ) <details<summary<strongBacktrace</strong</summary<p</p</details
Issue might be related (or this may be a duplicate of it).
This seems to be caused by Re-inserting gets rid of the ICE. What was the rationale for deleting that function?
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: 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 worked in this specific case, that function won't work if the TAIT were declared outside the impl block and only used, so the following would just hit a different ICE, even though it should be equivalent (except that the defining use scope is the surrounding module instead of just the impl block).
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:
I've found this does work if adding a bound on the TAIT: . It seems to me that should be required, so accepting code without it was actually a bug? Also, how does this work with NLL? I add and it still ICEs. (see the playground). Is there anything else needed for enabling NLL?
It seems the linked example on the playground does not ICE on the 2021-08-03 nightly.
that's with the fixed . Without it it ICEs, both with and without NLL
Hum, indeed, the 2 minimized examples Oli mentioned in 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.
This, and no longer ICE since
GATs issue triage: not blocking. Fixed; needs test.

Discussion:
<ins> #![feature(type_alias_impl_trait)] #![feature(generic_associated_types)] // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367 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> { //~ ERROR Struct(unimplemented!()) } } fn main() {} </ins>

<ins> error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/issue-87258_a.rs:19:21 | LL |     fn foo<'a>() -> Self::FooFuture<'a> { |                     ^^^^^^^^^^^^^^^^^^^ | = note: hidden type `Struct<'_>` captures lifetime '_#7r error: aborting due to previous error For more information about this error, try `rustc --explain E0700`. </ins>

<ins> #![feature(type_alias_impl_trait)] #![feature(generic_associated_types)] // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367 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> { //~ ERROR Struct(unimplemented!()) } } fn main() {} </ins>

<ins> error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/issue-87258_b.rs:21:21 | LL |     fn foo<'a>() -> Self::FooFuture<'a> { |                     ^^^^^^^^^^^^^^^^^^^ | = note: hidden type `Struct<'_>` captures lifetime '_#7r error: aborting due to previous error For more information about this error, try `rustc --explain E0700`. </ins>