]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-56229.rs
Auto merge of #79113 - andjo403:raw_vec_ptr, r=m-ou-se
[rust.git] / src / test / ui / issues / issue-56229.rs
1 // check-pass
2
3 trait Mirror {
4     type Other;
5 }
6
7 #[derive(Debug)]
8 struct Even(usize);
9 struct Odd;
10
11 impl Mirror for Even {
12     type Other = Odd;
13 }
14
15 impl Mirror for Odd {
16     type Other = Even;
17 }
18
19 trait Dyn<T: Mirror>: AsRef<<T as Mirror>::Other> {}
20
21 impl Dyn<Odd> for Even {}
22
23 impl AsRef<Even> for Even {
24     fn as_ref(&self) -> &Even {
25         self
26     }
27 }
28
29 fn code<T: Mirror>(d: &dyn Dyn<T>) -> &T::Other {
30     d.as_ref()
31 }
32
33 fn main() {
34     println!("{:?}", code(&Even(22)));
35 }