summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/transmute_ptr_to_ref.stderr
blob: 2993e5e7b0c91d45ac297ce04cc93dceb24d928b (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
error: transmute from a pointer type (`*const T`) to a reference type (`&T`)
  --> $DIR/transmute_ptr_to_ref.rs:8:17
   |
LL |     let _: &T = std::mem::transmute(p);
   |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p`
   |
   = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings`

error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
  --> $DIR/transmute_ptr_to_ref.rs:11:21
   |
LL |     let _: &mut T = std::mem::transmute(m);
   |                     ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m`

error: transmute from a pointer type (`*mut T`) to a reference type (`&T`)
  --> $DIR/transmute_ptr_to_ref.rs:14:17
   |
LL |     let _: &T = std::mem::transmute(m);
   |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m`

error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
  --> $DIR/transmute_ptr_to_ref.rs:17:21
   |
LL |     let _: &mut T = std::mem::transmute(p as *mut T);
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)`

error: transmute from a pointer type (`*const U`) to a reference type (`&T`)
  --> $DIR/transmute_ptr_to_ref.rs:20:17
   |
LL |     let _: &T = std::mem::transmute(o);
   |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)`

error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`)
  --> $DIR/transmute_ptr_to_ref.rs:23:21
   |
LL |     let _: &mut T = std::mem::transmute(om);
   |                     ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)`

error: transmute from a pointer type (`*mut U`) to a reference type (`&T`)
  --> $DIR/transmute_ptr_to_ref.rs:26:17
   |
LL |     let _: &T = std::mem::transmute(om);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)`

error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<u8>`)
  --> $DIR/transmute_ptr_to_ref.rs:36:32
   |
LL |     let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) };
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<_>>()`

error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<&u8>`)
  --> $DIR/transmute_ptr_to_ref.rs:38:33
   |
LL |     let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<&_>>()`

error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`)
  --> $DIR/transmute_ptr_to_ref.rs:42:14
   |
LL |     unsafe { std::mem::transmute::<_, Bar>(raw) };
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:47:14
   |
LL |         0 => std::mem::transmute(x),
   |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:48:14
   |
LL |         1 => std::mem::transmute(y),
   |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&u32>()`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:49:14
   |
LL |         2 => std::mem::transmute::<_, &&'b u32>(x),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:50:14
   |
LL |         _ => std::mem::transmute::<_, &&'b u32>(y),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&'b u32>()`

error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:58:19
   |
LL |     let _: &u32 = std::mem::transmute(a);
   |                   ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a`

error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:59:19
   |
LL |     let _: &u32 = std::mem::transmute::<_, &u32>(a);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a.cast::<u32>()`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:61:14
   |
LL |         0 => std::mem::transmute(x),
   |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:62:14
   |
LL |         _ => std::mem::transmute::<_, &&'b u32>(x),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()`

error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:70:19
   |
LL |     let _: &u32 = std::mem::transmute(a);
   |                   ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a`

error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:71:19
   |
LL |     let _: &u32 = std::mem::transmute::<_, &u32>(a);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const u32)`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:73:14
   |
LL |         0 => std::mem::transmute(x),
   |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &u32)`

error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
  --> $DIR/transmute_ptr_to_ref.rs:74:14
   |
LL |         _ => std::mem::transmute::<_, &&'b u32>(x),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &'b u32)`

error: aborting due to 22 previous errors