]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/hr-associated-type-bound-param-5.rs
feat(rustdoc): open sidebar menu when links inside it are focused
[rust.git] / src / test / ui / associated-types / hr-associated-type-bound-param-5.rs
1 // ignore-compare-mode-chalk
2 trait Cycle: Sized {
3     type Next: Cycle<Next = Self>;
4 }
5
6 impl<T> Cycle for Box<T> {
7     type Next = Vec<T>;
8 }
9
10 impl<T> Cycle for Vec<T> {
11     type Next = Box<T>;
12 }
13
14 trait X<'a, T: Cycle + for<'b> X<'b, T>>
15 where
16     for<'b> <T as X<'b, T>>::U: Clone,
17     for<'b> T::Next: X<'b, T::Next>,
18     for<'b> <T::Next as X<'b, T::Next>>::U: Clone,
19 {
20     type U: ?Sized;
21     fn f(x: &<T as X<'_, T>>::U) {
22         <<T as X<'_, T>>::U>::clone(x);
23     }
24 }
25
26 impl<S, T> X<'_, Vec<T>> for S {
27     type U = str;
28     //~^ ERROR the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied
29     //~| ERROR the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied
30 }
31
32 impl<S, T> X<'_, Box<T>> for S {
33     type U = str;
34     //~^ ERROR the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied
35     //~| ERROR the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied
36 }
37
38 pub fn main() {
39     <i32 as X<Box<i32>>>::f("abc");
40 }