// ignore-test: This now ICEs again. // build-pass #![feature(type_alias_impl_trait)] use std::marker::PhantomData; /* copied Index and TryFrom for convenience (and simplicity) */ trait MyIndex { type O; fn my_index(self) -> Self::O; } trait MyFrom: Sized { type Error; fn my_from(value: T) -> Result; } /* MCVE starts here */ trait F {} impl F for () {} type DummyT = impl F; fn _dummy_t() -> DummyT {} struct Phantom1(PhantomData); struct Phantom2(PhantomData); struct Scope(Phantom2>); impl Scope { fn new() -> Self { unimplemented!() } } impl MyFrom> for Phantom1 { type Error = (); fn my_from(_: Phantom2) -> Result { unimplemented!() } } impl>>, U> MyIndex> for Scope { type O = T; fn my_index(self) -> Self::O { MyFrom::my_from(self.0).ok().unwrap() } } fn main() { let _pos: Phantom1> = Scope::new().my_index(); }