]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/ty-outlives/issue-53789-1.rs
1 // Regression test for #53789.
5 use std
::collections
::BTreeMap
;
12 type Value
: ValueTree
;
15 type StrategyFor
<A
> = StrategyType
<'
static, A
>;
16 type StrategyType
<'a
, A
> = <A
as Arbitrary
<'a
>>::Strategy
;
18 impl<K
: ValueTree
, V
: ValueTree
> Strategy
for (K
, V
) {
19 type Value
= TupleValueTree
<(K
, V
)>;
22 impl<K
: ValueTree
, V
: ValueTree
> ValueTree
for TupleValueTree
<(K
, V
)> {
23 type Value
= BTreeMapValueTree
<K
, V
>;
26 struct TupleValueTree
<T
> {
30 struct BTreeMapStrategy
<K
, V
>(std
::marker
::PhantomData
<(K
, V
)>)
35 struct BTreeMapValueTree
<K
, V
>(std
::marker
::PhantomData
<(K
, V
)>)
40 impl<K
, V
> Strategy
for BTreeMapStrategy
<K
, V
>
45 type Value
= BTreeMapValueTree
<K
::Value
, V
::Value
>;
48 impl<K
, V
> ValueTree
for BTreeMapValueTree
<K
, V
>
53 type Value
= BTreeMap
<K
::Value
, V
::Value
>;
56 trait Arbitrary
<'a
>: Sized
{
57 fn arbitrary_with(args
: Self::Parameters
) -> Self::Strategy
;
59 type Strategy
: Strategy
<Value
= Self::ValueTree
>;
60 type ValueTree
: ValueTree
<Value
= Self>;
63 impl<'a
, A
, B
> Arbitrary
<'a
> for BTreeMap
<A
, B
>
65 A
: Arbitrary
<'
static>,
66 B
: Arbitrary
<'
static>,
67 StrategyFor
<A
>: '
static,
68 StrategyFor
<B
>: '
static,
70 type ValueTree
= <Self::Strategy
as Strategy
>::Value
;
71 type Parameters
= (A
::Parameters
, B
::Parameters
);
72 type Strategy
= BTreeMapStrategy
<A
::Strategy
, B
::Strategy
>;
73 fn arbitrary_with(args
: Self::Parameters
) -> BTreeMapStrategy
<A
::Strategy
, B
::Strategy
> {
75 btree_map(any_with
::<A
>(a
), any_with
::<B
>(b
))
79 fn btree_map
<K
: Strategy
+ '
static, V
: Strategy
>(key
: K
, value
: V
) -> BTreeMapStrategy
<K
, V
> {
83 fn any_with
<'a
, A
: Arbitrary
<'a
>>(args
: A
::Parameters
) -> StrategyType
<'a
, A
> {