// Regression test for #53789. // //@ check-pass use std::collections::BTreeMap; trait ValueTree { type Value; } trait Strategy { type Value: ValueTree; } type StrategyFor = StrategyType<'static, A>; type StrategyType<'a, A> = >::Strategy; impl Strategy for (K, V) { type Value = TupleValueTree<(K, V)>; } impl ValueTree for TupleValueTree<(K, V)> { type Value = BTreeMapValueTree; } struct TupleValueTree { tree: T, } struct BTreeMapStrategy(std::marker::PhantomData<(K, V)>) where K: Strategy, V: Strategy; struct BTreeMapValueTree(std::marker::PhantomData<(K, V)>) where K: ValueTree, V: ValueTree; impl Strategy for BTreeMapStrategy where K: Strategy, V: Strategy, { type Value = BTreeMapValueTree; } impl ValueTree for BTreeMapValueTree where K: ValueTree, V: ValueTree, { type Value = BTreeMap; } trait Arbitrary<'a>: Sized { fn arbitrary_with(args: Self::Parameters) -> Self::Strategy; type Parameters; type Strategy: Strategy; type ValueTree: ValueTree; } impl<'a, A, B> Arbitrary<'a> for BTreeMap where A: Arbitrary<'static>, B: Arbitrary<'static>, StrategyFor: 'static, StrategyFor: 'static, { type ValueTree = ::Value; type Parameters = (A::Parameters, B::Parameters); type Strategy = BTreeMapStrategy; fn arbitrary_with(args: Self::Parameters) -> BTreeMapStrategy { let (a, b) = args; btree_map(any_with::(a), any_with::(b)) } } fn btree_map(key: K, value: V) -> BTreeMapStrategy { unimplemented!() } fn any_with<'a, A: Arbitrary<'a>>(args: A::Parameters) -> StrategyType<'a, A> { unimplemented!() } fn main() { }