use std::mem::ManuallyDrop; trait Tr1 { type As1: Copy; } trait Tr2 { type As2: Copy; } struct S1; #[derive(Copy, Clone)] struct S2; impl Tr1 for S1 { type As1 = S2; } trait _Tr3 { type A: Iterator; //~^ ERROR associated type bounds are unstable //~| ERROR the trait bound `<::A as Iterator>::Item: Copy` is not satisfied type B: Iterator; //~^ ERROR associated type bounds are unstable } struct _St1> { //~^ ERROR associated type bounds are unstable outest: T, outer: T::As1, inner: ::As2, } enum _En1> { //~^ ERROR associated type bounds are unstable Outest(T), Outer(T::As1), Inner(::As2), } union _Un1> { //~^ ERROR associated type bounds are unstable outest: ManuallyDrop, outer: ManuallyDrop, inner: ManuallyDrop<::As2>, } type _TaWhere1 where T: Iterator = T; //~^ ERROR associated type bounds are unstable fn _apit(_: impl Tr1) {} //~^ ERROR associated type bounds are unstable fn _apit_dyn(_: &dyn Tr1) {} //~^ ERROR associated type bounds are unstable fn _rpit() -> impl Tr1 { S1 } //~^ ERROR associated type bounds are unstable fn _rpit_dyn() -> Box> { Box::new(S1) } //~^ ERROR associated type bounds are unstable const _cdef: impl Tr1 = S1; //~^ ERROR associated type bounds are unstable //~| ERROR `impl Trait` only allowed in function and inherent method return types // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. // const _cdef_dyn: &dyn Tr1 = &S1; static _sdef: impl Tr1 = S1; //~^ ERROR associated type bounds are unstable //~| ERROR `impl Trait` only allowed in function and inherent method return types // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. // static _sdef_dyn: &dyn Tr1 = &S1; fn main() { let _: impl Tr1 = S1; //~^ ERROR associated type bounds are unstable //~| ERROR `impl Trait` only allowed in function and inherent method return types // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed. // let _: &dyn Tr1 = &S1; }