summaryrefslogtreecommitdiffstats
path: root/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr
blob: aefe3fb8e25fdb58078964e51429df1d1e438657 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> $DIR/transmute-from-fn-item-types-error.rs:4:13
   |
LL |     let i = mem::transmute(bar);
   |             ^^^^^^^^^^^^^^
   |
   = note: source type: `unsafe fn() {bar}` (0 bits)
   = note: target type: `i8` (8 bits)

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:8:13
   |
LL |     let p = mem::transmute(foo);
   |             ^^^^^^^^^^^^^^
   |
   = note: source type: unsafe fn() -> (i8, *const (), Option<fn()>) {foo}
   = note: target type: *const ()
   = help: cast with `as` to a pointer instead

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:12:14
   |
LL |     let of = mem::transmute(main);
   |              ^^^^^^^^^^^^^^
   |
   = note: source type: fn() {main}
   = note: target type: Option<fn()>
   = help: cast with `as` to a pointer instead

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> $DIR/transmute-from-fn-item-types-error.rs:21:5
   |
LL |     mem::transmute::<_, u8>(main);
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: `fn() {main}` (0 bits)
   = note: target type: `u8` (8 bits)

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:25:5
   |
LL |     mem::transmute::<_, *mut ()>(foo);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: unsafe fn() -> (i8, *const (), Option<fn()>) {foo}
   = note: target type: *mut ()
   = help: cast with `as` to a pointer instead

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:29:5
   |
LL |     mem::transmute::<_, fn()>(bar);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: unsafe fn() {bar}
   = note: target type: fn()
   = help: cast with `as` to a pointer instead

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:38:5
   |
LL |     mem::transmute::<_, *mut ()>(Some(foo));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: unsafe fn() -> (i8, *const (), Option<fn()>) {foo}
   = note: target type: *mut ()
   = help: cast with `as` to a pointer instead

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:42:5
   |
LL |     mem::transmute::<_, fn()>(Some(bar));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: unsafe fn() {bar}
   = note: target type: fn()
   = help: cast with `as` to a pointer instead

error[E0591]: can't transmute zero-sized type
  --> $DIR/transmute-from-fn-item-types-error.rs:46:5
   |
LL |     mem::transmute::<_, Option<fn()>>(Some(baz));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: unsafe fn() {baz}
   = note: target type: Option<fn()>
   = help: cast with `as` to a pointer instead

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0512, E0591.
For more information about an error, try `rustc --explain E0512`.