1 // compile-flags: -Zsave-analysis
2 // This is also a regression test for #69415 and the above flag is needed.
4 #![feature(untagged_unions)]
6 trait Tr1 { type As1: Copy; }
7 trait Tr2 { type As2: Copy; }
10 #[derive(Copy, Clone)]
12 impl Tr1 for S1 { type As1 = S2; }
15 type A: Iterator<Item: Copy>;
16 //~^ ERROR associated type bounds are unstable
17 //~| ERROR the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is not satisfied
19 type B: Iterator<Item: 'static>;
20 //~^ ERROR associated type bounds are unstable
23 struct _St1<T: Tr1<As1: Tr2>> {
24 //~^ ERROR associated type bounds are unstable
27 inner: <T::As1 as Tr2>::As2,
30 enum _En1<T: Tr1<As1: Tr2>> {
31 //~^ ERROR associated type bounds are unstable
34 Inner(<T::As1 as Tr2>::As2),
37 union _Un1<T: Tr1<As1: Tr2>> {
38 //~^ ERROR associated type bounds are unstable
39 outest: std::mem::ManuallyDrop<T>,
41 inner: <T::As1 as Tr2>::As2,
44 type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
45 //~^ ERROR associated type bounds are unstable
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
52 fn _rpit() -> impl Tr1<As1: Copy> { S1 }
53 //~^ ERROR associated type bounds are unstable
55 fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
56 //~^ ERROR associated type bounds are unstable
58 const _cdef: impl Tr1<As1: Copy> = S1;
59 //~^ ERROR associated type bounds are unstable
60 //~| ERROR `impl Trait` only allowed in function and inherent method return types
61 // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
62 // const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;
64 static _sdef: impl Tr1<As1: Copy> = S1;
65 //~^ ERROR associated type bounds are unstable
66 //~| ERROR `impl Trait` only allowed in function and inherent method return types
67 // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
68 // static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;
71 let _: impl Tr1<As1: Copy> = S1;
72 //~^ ERROR associated type bounds are unstable
73 //~| ERROR `impl Trait` only allowed in function and inherent method return types
74 // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
75 // let _: &dyn Tr1<As1: Copy> = &S1;