]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-86787.rs
Rollup merge of #87260 - antoyo:libgccjit-codegen, r=Mark-Simulacrum
[rust.git] / src / test / ui / generic-associated-types / issue-86787.rs
1 #![feature(generic_associated_types)]
2 // check-fail
3
4 enum Either<L, R> {
5     Left(L),
6     Right(R),
7 }
8
9 pub trait HasChildrenOf {
10     type T;
11     type TRef<'a>;
12
13     fn ref_children<'a>(&'a self) -> Vec<Self::TRef<'a>>;
14     fn take_children(self) -> Vec<Self::T>;
15 }
16
17 impl<Left, Right> HasChildrenOf for Either<Left, Right>
18 where
19     Left: HasChildrenOf,
20     Right: HasChildrenOf,
21 {
22     type T = Either<Left::T, Right::T>;
23     type TRef<'a>
24     //~^ the associated type
25     //~^^ the associated type
26     where
27     <Left as HasChildrenOf>::T: 'a,
28     <Right as HasChildrenOf>::T: 'a
29     = Either<&'a Left::T, &'a Right::T>;
30
31     fn ref_children<'a>(&'a self) -> Vec<Self::TRef<'a>> {
32         todo!()
33     }
34
35     fn take_children(self) -> Vec<Self::T> {
36         todo!()
37     }
38 }
39
40 fn main() {}