]> git.lizzy.rs Git - rust.git/blob - tests/ui/transmute_ptr_to_ptr.stderr
rustup https://github.com/rust-lang/rust/pull/69189
[rust.git] / tests / ui / transmute_ptr_to_ptr.stderr
1 error: transmute from a type (`&T`) to itself
2   --> $DIR/transmute_ptr_to_ptr.rs:8:5
3    |
4 LL |     std::mem::transmute::<&'a T, &'static T>(t)
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::useless-transmute` implied by `-D warnings`
8
9 error: transmute from a type (`&T`) to itself
10   --> $DIR/transmute_ptr_to_ptr.rs:13:5
11    |
12 LL |     std::mem::transmute::<&'a T, &'b T>(t)
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
15 error: transmute from a pointer to a pointer
16   --> $DIR/transmute_ptr_to_ptr.rs:29:29
17    |
18 LL |         let _: *const f32 = std::mem::transmute(ptr);
19    |                             ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr as *const f32`
20    |
21    = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
22
23 error: transmute from a pointer to a pointer
24   --> $DIR/transmute_ptr_to_ptr.rs:30:27
25    |
26 LL |         let _: *mut f32 = std::mem::transmute(mut_ptr);
27    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `mut_ptr as *mut f32`
28
29 error: transmute from a reference to a reference
30   --> $DIR/transmute_ptr_to_ptr.rs:32:23
31    |
32 LL |         let _: &f32 = std::mem::transmute(&1u32);
33    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)`
34
35 error: transmute from a reference to a reference
36   --> $DIR/transmute_ptr_to_ptr.rs:33:23
37    |
38 LL |         let _: &f64 = std::mem::transmute(&1f32);
39    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f32 as *const f32 as *const f64)`
40
41 error: transmute from a reference to a reference
42   --> $DIR/transmute_ptr_to_ptr.rs:36:27
43    |
44 LL |         let _: &mut f32 = std::mem::transmute(&mut 1u32);
45    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)`
46
47 error: transmute from a reference to a reference
48   --> $DIR/transmute_ptr_to_ptr.rs:37:37
49    |
50 LL |         let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t: 1u32 });
51    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
52
53 error: transmute from a type (`&LifetimeParam`) to itself
54   --> $DIR/transmute_ptr_to_ptr.rs:50:47
55    |
56 LL |     let _: &LifetimeParam<'static> = unsafe { std::mem::transmute(&lp) };
57    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^
58
59 error: transmute from a type (`&GenericParam<&LifetimeParam>`) to itself
60   --> $DIR/transmute_ptr_to_ptr.rs:51:62
61    |
62 LL |     let _: &GenericParam<&LifetimeParam<'static>> = unsafe { std::mem::transmute(&GenericParam { t: &lp }) };
63    |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64
65 error: aborting due to 10 previous errors
66