rust-clippy/tests/ui/transmute_ptr_to_ptr.stderr
Matthias Krüger b875c53d2c rustup https://github.com/rust-lang/rust/pull/69189
rustups https://github.com/rust-lang/rust/pull/69189 which is part of https://github.com/rust-lang/rust/pull/70085
(at least I think this is the only pr that changes clippy test stdout)
2020-03-18 03:27:05 +01:00

66 lines
2.8 KiB
Text

error: transmute from a type (`&T`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:8:5
|
LL | std::mem::transmute::<&'a T, &'static T>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::useless-transmute` implied by `-D warnings`
error: transmute from a type (`&T`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:13:5
|
LL | std::mem::transmute::<&'a T, &'b T>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: transmute from a pointer to a pointer
--> $DIR/transmute_ptr_to_ptr.rs:29:29
|
LL | let _: *const f32 = std::mem::transmute(ptr);
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr as *const f32`
|
= note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
error: transmute from a pointer to a pointer
--> $DIR/transmute_ptr_to_ptr.rs:30:27
|
LL | let _: *mut f32 = std::mem::transmute(mut_ptr);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `mut_ptr as *mut f32`
error: transmute from a reference to a reference
--> $DIR/transmute_ptr_to_ptr.rs:32:23
|
LL | let _: &f32 = std::mem::transmute(&1u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)`
error: transmute from a reference to a reference
--> $DIR/transmute_ptr_to_ptr.rs:33:23
|
LL | let _: &f64 = std::mem::transmute(&1f32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f32 as *const f32 as *const f64)`
error: transmute from a reference to a reference
--> $DIR/transmute_ptr_to_ptr.rs:36:27
|
LL | let _: &mut f32 = std::mem::transmute(&mut 1u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)`
error: transmute from a reference to a reference
--> $DIR/transmute_ptr_to_ptr.rs:37:37
|
LL | let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t: 1u32 });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
error: transmute from a type (`&LifetimeParam`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:50:47
|
LL | let _: &LifetimeParam<'static> = unsafe { std::mem::transmute(&lp) };
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: transmute from a type (`&GenericParam<&LifetimeParam>`) to itself
--> $DIR/transmute_ptr_to_ptr.rs:51:62
|
LL | let _: &GenericParam<&LifetimeParam<'static>> = unsafe { std::mem::transmute(&GenericParam { t: &lp }) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 10 previous errors