3 #![allow(incomplete_features)]
4 #![feature(generic_const_exprs)]
6 use std::marker::PhantomData;
9 let x = FooImpl::<BarImpl<1>> { phantom: PhantomData };
10 let _ = x.foo::<BarImpl<1>>();
20 <T as Operation<U>>::Output: Bar;
27 phantom: PhantomData<T>,
30 impl<T> Foo<T> for FooImpl<T>
37 <T as Operation<U>>::Output: Bar,
39 <<T as Operation<U>>::Output as Bar>::error_occurs_here();
44 fn error_occurs_here();
47 struct BarImpl<const N: usize>;
49 impl<const N: usize> Bar for BarImpl<N> {
50 fn error_occurs_here() {}
53 trait Operation<Rhs> {
57 //// Part-A: This causes error.
58 impl<const M: usize, const N: usize> Operation<BarImpl<M>> for BarImpl<N>
60 BarImpl<{ N + M }>: Sized,
62 type Output = BarImpl<{ N + M }>;
65 //// Part-B: This doesn't cause error.
66 // impl<const M: usize, const N: usize> Operation<BarImpl<M>> for BarImpl<N> {
67 // type Output = BarImpl<M>;
70 //// Part-C: This also doesn't cause error.
71 // impl<const M: usize, const N: usize> Operation<BarImpl<M>> for BarImpl<N> {
72 // type Output = BarImpl<{ M }>;