]> git.proxmox.com Git - rustc.git/blame - src/test/ui/associated-types/hr-associated-type-bound-param-5.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / associated-types / hr-associated-type-bound-param-5.rs
CommitLineData
f035d41b
XL
1trait Cycle: Sized {
2 type Next: Cycle<Next = Self>;
3}
4
5impl<T> Cycle for Box<T> {
6 type Next = Vec<T>;
7}
8
9impl<T> Cycle for Vec<T> {
10 type Next = Box<T>;
11}
12
13trait X<'a, T: Cycle + for<'b> X<'b, T>>
14where
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
25impl<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
31impl<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
37pub fn main() {
38 <i32 as X<Box<i32>>>::f("abc");
39}