// build-pass #![allow(incomplete_features)] #![feature(generic_const_exprs)] use std::marker::PhantomData; fn main() { let x = FooImpl::> { phantom: PhantomData }; let _ = x.foo::>(); } trait Foo where T: Bar, { fn foo(&self) where T: Operation, >::Output: Bar; } struct FooImpl where T: Bar, { phantom: PhantomData, } impl Foo for FooImpl where T: Bar, { fn foo(&self) where T: Operation, >::Output: Bar, { <>::Output as Bar>::error_occurs_here(); } } trait Bar { fn error_occurs_here(); } struct BarImpl; impl Bar for BarImpl { fn error_occurs_here() {} } trait Operation { type Output; } //// Part-A: This causes error. impl Operation> for BarImpl where BarImpl<{ N + M }>: Sized, { type Output = BarImpl<{ N + M }>; } //// Part-B: This doesn't cause error. // impl Operation> for BarImpl { // type Output = BarImpl; // } //// Part-C: This also doesn't cause error. // impl Operation> for BarImpl { // type Output = BarImpl<{ M }>; // }