1 #![feature(associated_type_bounds)]
3 use std
::mem
::ManuallyDrop
;
5 struct S1 { f: dyn Iterator<Item: Copy> }
6 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
7 struct S2 { f: Box<dyn Iterator<Item: Copy>> }
8 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
9 struct S3 { f: dyn Iterator<Item: 'static> }
10 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
12 enum E1 { V(dyn Iterator<Item: Copy>) }
13 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
14 //~| ERROR the size for values of type `(dyn Iterator<Item = impl Copy> + 'static)`
15 enum E2 { V(Box<dyn Iterator<Item: Copy>>) }
16 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
17 enum E3 { V(dyn Iterator<Item: 'static>) }
18 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
19 //~| ERROR the size for values of type `(dyn Iterator<Item = impl Sized + 'static> + 'static)`
21 union U1 { f: ManuallyDrop<dyn Iterator<Item: Copy>> }
22 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
23 //~| ERROR the size for values of type `(dyn Iterator<Item = impl Copy> + 'static)`
24 union U2 { f: ManuallyDrop<Box<dyn Iterator<Item: Copy>>> }
25 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
26 union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
27 //~^ ERROR associated type bounds are not allowed within structs, enums, or unions
28 //~| ERROR the size for values of type `(dyn Iterator<Item = impl Sized + 'static> + 'static)`