]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
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; | |
1b1a35ee XL |
27 | //~^ ERROR the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied |
28 | //~| ERROR the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied | |
f035d41b XL |
29 | } |
30 | ||
31 | impl<S, T> X<'_, Box<T>> for S { | |
32 | type U = str; | |
1b1a35ee XL |
33 | //~^ ERROR the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied |
34 | //~| ERROR the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied | |
f035d41b XL |
35 | } |
36 | ||
37 | pub fn main() { | |
38 | <i32 as X<Box<i32>>>::f("abc"); | |
39 | } |