]> git.lizzy.rs Git - rust.git/blob - tests/ui/transmute_ptr_to_ref.stderr
iterate List by value
[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:4: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:7: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:10: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:13: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:16: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:19: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:22: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:32:32
47    |
48 LL |     let _: &Foo<u8> = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) };
49    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const 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:34:33
53    |
54 LL |     let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };
55    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<&_>)`
56
57 error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`)
58   --> $DIR/transmute_ptr_to_ref.rs:38:14
59    |
60 LL |     unsafe { std::mem::transmute::<_, Bar>(raw) };
61    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)`
62
63 error: aborting due to 10 previous errors
64