]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-type-bounds/inside-adt.rs
Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebank
[rust.git] / src / test / ui / associated-type-bounds / inside-adt.rs
1 #![feature(associated_type_bounds)]
2
3 use std::mem::ManuallyDrop;
4
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
11
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)`
20
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)`
29
30 fn main() {}