GAT and TAIT with lifetime type parameters fail `std::marker::Sized` requirement

Playing around with (the not yet stable) GAT and TAIT (https://github.com/rust-lang/rust/issues/63063) features I stumbled over the below problem, where type parameters to nested TAIT/GAT with lifetime parameters cause a "this type parameter needs to be std::marker::Sized" compiler error.

Now, I am wondering whether this is a bug in the current GAT/TAIT implementation or whether this is and expected limitation.


#![feature(type_alias_impl_trait)]
#![feature(generic_associated_types)]

extern crate futures;
use futures::Stream;
use std::future::Future;

trait X {
    type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a;

    type LineStreamFut<'a,Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;

    fn line_stream<'a,Repr>(&'a self) -> Self::LineStreamFut<'a,Repr>;
}

struct Y;

impl X for Y {
    type LineStream<'a, Repr> = impl Stream<Item = Repr>;

    type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ;

    fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
        async {futures::stream::empty()}
    }
}

fn main() {}

(Playground)

Errors:

warning: the cargo feature `edition2021` has been stabilized in the 1.56 release and is no longer necessary to be listed in the manifest
  See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature.
   Compiling playground v0.0.1 (/playground)
error[E0277]: the size for values of type `Repr` cannot be known at compilation time
  --> src/main.rs:23:43
   |
23 |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
   |                        ----               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
   |                        |
   |                        this type parameter needs to be `std::marker::Sized`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error


In contrast, the following code, without lifetime type parameters compiles without any error.

#![feature(type_alias_impl_trait)]
#![feature(generic_associated_types)]

extern crate futures;
use futures::Stream;
use std::future::Future;

trait X {
    type LineStream<Repr>: Stream<Item = Repr>;

    type LineStreamFut<Repr>: Future<Output = Self::LineStream<Repr>>;

    fn line_stream<Repr>(&self) -> Self::LineStreamFut<Repr>;
}

struct Y;

impl X for Y {
    type LineStream<Repr> = impl Stream<Item = Repr>;

    type LineStreamFut<Repr> = impl Future<Output = Self::LineStream<Repr>> ;

    fn line_stream<Repr>(&self) -> Self::LineStreamFut<Repr> {
        async {futures::stream::empty()}
    }
}

fn main() {}

I created GAT & TAIT with lifetime type parameters fail `std::marker::Sized` requirement · Issue #89008 · rust-lang/rust · GitHub to be on the safe side.