]>
Commit | Line | Data |
---|---|---|
f9f354fc XL |
1 | // compile-flags: -Zsave-analysis |
2 | // This is also a regression test for #69415 and the above flag is needed. | |
3 | ||
dc9dc135 XL |
4 | #![feature(untagged_unions)] |
5 | ||
e74abb32 XL |
6 | trait Tr1 { type As1: Copy; } |
7 | trait Tr2 { type As2: Copy; } | |
dc9dc135 XL |
8 | |
9 | struct S1; | |
10 | #[derive(Copy, Clone)] | |
11 | struct S2; | |
12 | impl Tr1 for S1 { type As1 = S2; } | |
13 | ||
14 | trait _Tr3 { | |
15 | type A: Iterator<Item: Copy>; | |
16 | //~^ ERROR associated type bounds are unstable | |
29967ef6 | 17 | //~| ERROR the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is not satisfied |
dc9dc135 XL |
18 | |
19 | type B: Iterator<Item: 'static>; | |
20 | //~^ ERROR associated type bounds are unstable | |
21 | } | |
22 | ||
23 | struct _St1<T: Tr1<As1: Tr2>> { | |
24 | //~^ ERROR associated type bounds are unstable | |
25 | outest: T, | |
26 | outer: T::As1, | |
27 | inner: <T::As1 as Tr2>::As2, | |
28 | } | |
29 | ||
30 | enum _En1<T: Tr1<As1: Tr2>> { | |
31 | //~^ ERROR associated type bounds are unstable | |
32 | Outest(T), | |
33 | Outer(T::As1), | |
34 | Inner(<T::As1 as Tr2>::As2), | |
35 | } | |
36 | ||
37 | union _Un1<T: Tr1<As1: Tr2>> { | |
38 | //~^ ERROR associated type bounds are unstable | |
e74abb32 | 39 | outest: std::mem::ManuallyDrop<T>, |
dc9dc135 XL |
40 | outer: T::As1, |
41 | inner: <T::As1 as Tr2>::As2, | |
42 | } | |
43 | ||
44 | type _TaWhere1<T> where T: Iterator<Item: Copy> = T; | |
45 | //~^ ERROR associated type bounds are unstable | |
46 | ||
47 | fn _apit(_: impl Tr1<As1: Copy>) {} | |
48 | //~^ ERROR associated type bounds are unstable | |
49 | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {} | |
50 | //~^ ERROR associated type bounds are unstable | |
51 | ||
52 | fn _rpit() -> impl Tr1<As1: Copy> { S1 } | |
53 | //~^ ERROR associated type bounds are unstable | |
54 | ||
55 | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) } | |
56 | //~^ ERROR associated type bounds are unstable | |
57 | ||
58 | const _cdef: impl Tr1<As1: Copy> = S1; | |
59 | //~^ ERROR associated type bounds are unstable | |
136023e0 | 60 | //~| ERROR `impl Trait` not allowed outside of function and method return types [E0562] |
dc9dc135 XL |
61 | // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. |
62 | // const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1; | |
63 | ||
64 | static _sdef: impl Tr1<As1: Copy> = S1; | |
65 | //~^ ERROR associated type bounds are unstable | |
136023e0 | 66 | //~| ERROR `impl Trait` not allowed outside of function and method return types [E0562] |
dc9dc135 XL |
67 | // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. |
68 | // static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1; | |
69 | ||
70 | fn main() { | |
71 | let _: impl Tr1<As1: Copy> = S1; | |
72 | //~^ ERROR associated type bounds are unstable | |
136023e0 | 73 | //~| ERROR `impl Trait` not allowed outside of function and method return types [E0562] |
dc9dc135 XL |
74 | // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. |
75 | // let _: &dyn Tr1<As1: Copy> = &S1; | |
76 | } |