blob: ba9e6df6c2d7c4b4397d6d833d5bc698a452e907 [file] [log] [blame]
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:39:29
|
LL | let _: *const f32 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
help: use `pointer::cast` instead
|
LL - let _: *const f32 = transmute(ptr);
LL + let _: *const f32 = ptr.cast::<f32>();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:42:27
|
LL | let _: *mut f32 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast` instead
|
LL - let _: *mut f32 = transmute(mut_ptr);
LL + let _: *mut f32 = mut_ptr.cast::<f32>();
|
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:46:23
|
LL | let _: &f32 = transmute(&1u32);
| ^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:49:23
|
LL | let _: &f32 = transmute(&1f64);
| ^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:54:27
|
LL | let _: &mut f32 = transmute(&mut 1u32);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:57:37
|
LL | let _: &GenericParam<f32> = transmute(&GenericParam { t: 1u32 });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
error: transmute from a reference to a reference
--> tests/ui/transmute_ptr_to_ptr.rs:61:27
|
LL | let u8_ref: &u8 = transmute(u64_ref);
| ^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8)`
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:64:29
|
LL | let _: *const u32 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast_const` instead
|
LL - let _: *const u32 = transmute(mut_ptr);
LL + let _: *const u32 = mut_ptr.cast_const();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:67:27
|
LL | let _: *mut u32 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use `pointer::cast_mut` instead
|
LL - let _: *mut u32 = transmute(ptr);
LL + let _: *mut u32 = ptr.cast_mut();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:81:29
|
LL | let _: *const f32 = transmute(Ptr(ptr));
| ^^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast` instead
|
LL - let _: *const f32 = transmute(Ptr(ptr));
LL + let _: *const f32 = Ptr(ptr).0.cast::<f32>();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:83:29
|
LL | let _: *const f32 = transmute(PtrNamed { ptr });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast` instead
|
LL - let _: *const f32 = transmute(PtrNamed { ptr });
LL + let _: *const f32 = PtrNamed { ptr }.ptr.cast::<f32>();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:85:27
|
LL | let _: *mut u32 = transmute(Ptr(ptr));
| ^^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast_mut` instead
|
LL - let _: *mut u32 = transmute(Ptr(ptr));
LL + let _: *mut u32 = Ptr(ptr).0.cast_mut();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:91:14
|
LL | unsafe { transmute(v) }
| ^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - unsafe { transmute(v) }
LL + unsafe { v as *const &() }
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:108:28
|
LL | let _: *const i8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *const i8 = transmute(ptr);
LL + let _: *const i8 = ptr as *const i8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:110:28
|
LL | let _: *const i8 = transmute(Ptr8(ptr));
| ^^^^^^^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *const i8 = transmute(Ptr8(ptr));
LL + let _: *const i8 = Ptr8(ptr).0 as *const i8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:118:28
|
LL | let _: *const i8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use `pointer::cast` instead
|
LL - let _: *const i8 = transmute(ptr);
LL + let _: *const i8 = ptr.cast::<i8>();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:126:26
|
LL | let _: *mut u8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *mut u8 = transmute(ptr);
LL + let _: *mut u8 = ptr as *mut u8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:128:28
|
LL | let _: *const u8 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use an `as` cast instead
|
LL - let _: *const u8 = transmute(mut_ptr);
LL + let _: *const u8 = mut_ptr as *const u8;
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:136:26
|
LL | let _: *mut u8 = transmute(ptr);
| ^^^^^^^^^^^^^^
|
help: use `pointer::cast_mut` instead
|
LL - let _: *mut u8 = transmute(ptr);
LL + let _: *mut u8 = ptr.cast_mut();
|
error: transmute from a pointer to a pointer
--> tests/ui/transmute_ptr_to_ptr.rs:138:28
|
LL | let _: *const u8 = transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^
|
help: use `pointer::cast_const` instead
|
LL - let _: *const u8 = transmute(mut_ptr);
LL + let _: *const u8 = mut_ptr.cast_const();
|
error: aborting due to 20 previous errors