summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsized/unsized-enum2.rs
blob: d589f5ae582c6689bf74b060bd25f501050b187b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use std::ops::Deref;

// Due to aggressive error message deduplication, we require 20 *different*
// unsized types (even Path and [u8] are considered the "same").

trait Foo {}
trait Bar {}
trait FooBar {}
trait BarFoo {}

trait PathHelper1 {}
trait PathHelper2 {}
trait PathHelper3 {}
trait PathHelper4 {}

struct Path1(dyn PathHelper1);
struct Path2(dyn PathHelper2);
struct Path3(dyn PathHelper3);
struct Path4(dyn PathHelper4);

enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
    // parameter
    VA(W),
    //~^ ERROR the size for values of type
    VB{x: X},
    //~^ ERROR the size for values of type
    VC(isize, Y),
    //~^ ERROR the size for values of type
    VD{u: isize, x: Z},
    //~^ ERROR the size for values of type

    // slice / str
    VE([u8]),
    //~^ ERROR the size for values of type
    VF{x: str},
    //~^ ERROR the size for values of type
    VG(isize, [f32]),
    //~^ ERROR the size for values of type
    VH{u: isize, x: [u32]},
    //~^ ERROR the size for values of type

    // unsized struct
    VI(Path1),
    //~^ ERROR the size for values of type
    VJ{x: Path2},
    //~^ ERROR the size for values of type
    VK(isize, Path3),
    //~^ ERROR the size for values of type
    VL{u: isize, x: Path4},
    //~^ ERROR the size for values of type

    // plain trait
    VM(dyn Foo),
    //~^ ERROR the size for values of type
    VN{x: dyn Bar},
    //~^ ERROR the size for values of type
    VO(isize, dyn FooBar),
    //~^ ERROR the size for values of type
    VP{u: isize, x: dyn BarFoo},
    //~^ ERROR the size for values of type

    // projected
    VQ(<&'static [i8] as Deref>::Target),
    //~^ ERROR the size for values of type
    VR{x: <&'static [char] as Deref>::Target},
    //~^ ERROR the size for values of type
    VS(isize, <&'static [f64] as Deref>::Target),
    //~^ ERROR the size for values of type
    VT{u: isize, x: <&'static [i32] as Deref>::Target},
    //~^ ERROR the size for values of type
}


fn main() { }