]> git.lizzy.rs Git - rust.git/blob - tests/ui/transmute_ptr_to_ref.stderr
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / transmute_ptr_to_ref.stderr
1 error: transmute from a pointer type (`*const T`) to a reference type (`&T`)
2   --> $DIR/transmute_ptr_to_ref.rs:8:17
3    |
4 LL |     let _: &T = std::mem::transmute(p);
5    |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p`
6    |
7    = note: `-D clippy::transmute-ptr-to-ref` implied by `-D warnings`
8
9 error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
10   --> $DIR/transmute_ptr_to_ref.rs:11:21
11    |
12 LL |     let _: &mut T = std::mem::transmute(m);
13    |                     ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m`
14
15 error: transmute from a pointer type (`*mut T`) to a reference type (`&T`)
16   --> $DIR/transmute_ptr_to_ref.rs:14:17
17    |
18 LL |     let _: &T = std::mem::transmute(m);
19    |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m`
20
21 error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`)
22   --> $DIR/transmute_ptr_to_ref.rs:17:21
23    |
24 LL |     let _: &mut T = std::mem::transmute(p as *mut T);
25    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)`
26
27 error: transmute from a pointer type (`*const U`) to a reference type (`&T`)
28   --> $DIR/transmute_ptr_to_ref.rs:20:17
29    |
30 LL |     let _: &T = std::mem::transmute(o);
31    |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)`
32
33 error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`)
34   --> $DIR/transmute_ptr_to_ref.rs:23:21
35    |
36 LL |     let _: &mut T = std::mem::transmute(om);
37    |                     ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)`
38
39 error: transmute from a pointer type (`*mut U`) to a reference type (`&T`)
40   --> $DIR/transmute_ptr_to_ref.rs:26:17
41    |
42 LL |     let _: &T = std::mem::transmute(om);
43    |                 ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)`
44
45 error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<'_, u8>`)
46   --> $DIR/transmute_ptr_to_ref.rs:36:32
47    |
48 LL |     let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) };
49    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<_>>()`
50
51 error: transmute from a pointer type (`*const i32`) to a reference type (`&_issue1231::Foo<'_, &u8>`)
52   --> $DIR/transmute_ptr_to_ref.rs:38:33
53    |
54 LL |     let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };
55    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::<Foo<&_>>()`
56
57 error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`)
58   --> $DIR/transmute_ptr_to_ref.rs:42:14
59    |
60 LL |     unsafe { std::mem::transmute::<_, Bar>(raw) };
61    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)`
62
63 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
64   --> $DIR/transmute_ptr_to_ref.rs:47:14
65    |
66 LL |         0 => std::mem::transmute(x),
67    |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()`
68
69 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
70   --> $DIR/transmute_ptr_to_ref.rs:48:14
71    |
72 LL |         1 => std::mem::transmute(y),
73    |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&u32>()`
74
75 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
76   --> $DIR/transmute_ptr_to_ref.rs:49:14
77    |
78 LL |         2 => std::mem::transmute::<_, &&'b u32>(x),
79    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()`
80
81 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
82   --> $DIR/transmute_ptr_to_ref.rs:50:14
83    |
84 LL |         _ => std::mem::transmute::<_, &&'b u32>(y),
85    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&'b u32>()`
86
87 error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
88   --> $DIR/transmute_ptr_to_ref.rs:58:19
89    |
90 LL |     let _: &u32 = std::mem::transmute(a);
91    |                   ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a`
92
93 error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
94   --> $DIR/transmute_ptr_to_ref.rs:59:19
95    |
96 LL |     let _: &u32 = std::mem::transmute::<_, &u32>(a);
97    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a.cast::<u32>()`
98
99 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
100   --> $DIR/transmute_ptr_to_ref.rs:61:14
101    |
102 LL |         0 => std::mem::transmute(x),
103    |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()`
104
105 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
106   --> $DIR/transmute_ptr_to_ref.rs:62:14
107    |
108 LL |         _ => std::mem::transmute::<_, &&'b u32>(x),
109    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()`
110
111 error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
112   --> $DIR/transmute_ptr_to_ref.rs:70:19
113    |
114 LL |     let _: &u32 = std::mem::transmute(a);
115    |                   ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a`
116
117 error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`)
118   --> $DIR/transmute_ptr_to_ref.rs:71:19
119    |
120 LL |     let _: &u32 = std::mem::transmute::<_, &u32>(a);
121    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const u32)`
122
123 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
124   --> $DIR/transmute_ptr_to_ref.rs:73:14
125    |
126 LL |         0 => std::mem::transmute(x),
127    |              ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &u32)`
128
129 error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`)
130   --> $DIR/transmute_ptr_to_ref.rs:74:14
131    |
132 LL |         _ => std::mem::transmute::<_, &&'b u32>(x),
133    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &'b u32)`
134
135 error: aborting due to 22 previous errors
136