2 // Regression test for #31299. This was generating an overflow error
3 // because of eager normalization:
5 // proving `M: Sized` requires
6 // - proving `PtrBack<Vec<M>>: Sized` requires
7 // - normalizing `Vec<<Vec<M> as Front>::Back>>: Sized` requires
8 // - proving `Vec<M>: Front` requires
9 // - `M: Sized` <-- cycle!
11 // If we skip the normalization step, though, everything goes fine.
13 // This could be fixed by implementing lazy normalization everywhere.
15 // However, we want this to work before then. For that, when checking
16 // whether a type is Sized we only check that the tails are Sized. As
17 // PtrBack does not have a tail, we don't need to normalize anything
24 impl<T> Front for Vec<T> {
28 struct PtrBack<T: Front>(#[allow(unused_tuple_struct_fields)] Vec<T::Back>);
30 struct M(#[allow(unused_tuple_struct_fields)] PtrBack<Vec<M>>);
32 #[allow(unused_must_use)]
34 std::mem::size_of::<M>();