]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/hr-associated-type-bound-param-5.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / associated-types / hr-associated-type-bound-param-5.rs
1 trait Cycle: Sized {
2 type Next: Cycle<Next = Self>;
3 }
4
5 impl<T> Cycle for Box<T> {
6 type Next = Vec<T>;
7 }
8
9 impl<T> Cycle for Vec<T> {
10 type Next = Box<T>;
11 }
12
13 trait X<'a, T: Cycle + for<'b> X<'b, T>>
14 where
15 for<'b> <T as X<'b, T>>::U: Clone,
16 for<'b> T::Next: X<'b, T::Next>,
17 for<'b> <T::Next as X<'b, T::Next>>::U: Clone,
18 {
19 type U: ?Sized;
20 fn f(x: &<T as X<'_, T>>::U) {
21 <<T as X<'_, T>>::U>::clone(x);
22 }
23 }
24
25 impl<S, T> X<'_, Vec<T>> for S {
26 type U = str;
27 //~^ ERROR the trait bound `str: Clone` is not satisfied
28 }
29
30 impl<S, T> X<'_, Box<T>> for S {
31 type U = str;
32 //~^ ERROR the trait bound `str: Clone` is not satisfied
33 }
34
35 pub fn main() {
36 <i32 as X<Box<i32>>>::f("abc");
37 }