File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
src/tools/clippy/tests/ui Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -35,16 +35,16 @@ fn transmute_ptr_to_ptr() {
3535 // ref-ref transmutes; bad
3636 let _: &f32 = &*(&1u32 as *const u32 as *const f32);
3737 //~^ ERROR: transmute from a reference to a reference
38- let _: &f64 = &*(&1f32 as *const f32 as *const f64 );
38+ let _: &f32 = &*(&1f64 as *const f64 as *const f32 );
3939 //~^ ERROR: transmute from a reference to a reference
4040 //:^ this test is here because both f32 and f64 are the same TypeVariant, but they are not
4141 // the same type
4242 let _: &mut f32 = &mut *(&mut 1u32 as *mut u32 as *mut f32);
4343 //~^ ERROR: transmute from a reference to a reference
4444 let _: &GenericParam<f32> = &*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>);
4545 //~^ ERROR: transmute from a reference to a reference
46- let u8_ref : &u8 = &0u8 ;
47- let u64_ref : &u64 = unsafe { &*(u8_ref as *const u8 as *const u64 ) };
46+ let u64_ref : &u64 = &0u64 ;
47+ let u8_ref : &u8 = unsafe { &*(u64_ref as *const u64 as *const u8 ) };
4848 //~^ ERROR: transmute from a reference to a reference
4949 }
5050
Original file line number Diff line number Diff line change @@ -35,16 +35,16 @@ fn transmute_ptr_to_ptr() {
3535 // ref-ref transmutes; bad
3636 let _: & f32 = std:: mem:: transmute ( & 1u32 ) ;
3737 //~^ ERROR: transmute from a reference to a reference
38- let _: & f64 = std:: mem:: transmute ( & 1f32 ) ;
38+ let _: & f32 = std:: mem:: transmute ( & 1f64 ) ;
3939 //~^ ERROR: transmute from a reference to a reference
4040 //:^ this test is here because both f32 and f64 are the same TypeVariant, but they are not
4141 // the same type
4242 let _: & mut f32 = std:: mem:: transmute ( & mut 1u32 ) ;
4343 //~^ ERROR: transmute from a reference to a reference
4444 let _: & GenericParam < f32 > = std:: mem:: transmute ( & GenericParam { t : 1u32 } ) ;
4545 //~^ ERROR: transmute from a reference to a reference
46- let u8_ref : & u8 = & 0u8 ;
47- let u64_ref : & u64 = unsafe { std:: mem:: transmute ( u8_ref ) } ;
46+ let u64_ref : & u64 = & 0u64 ;
47+ let u8_ref : & u8 = unsafe { std:: mem:: transmute ( u64_ref ) } ;
4848 //~^ ERROR: transmute from a reference to a reference
4949 }
5050
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ LL | let _: &f32 = std::mem::transmute(&1u32);
2222error: transmute from a reference to a reference
2323 --> $DIR/transmute_ptr_to_ptr.rs:38:23
2424 |
25- LL | let _: &f64 = std::mem::transmute(&1f32 );
26- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f32 as *const f32 as *const f64 )`
25+ LL | let _: &f32 = std::mem::transmute(&1f64 );
26+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32 )`
2727
2828error: transmute from a reference to a reference
2929 --> $DIR/transmute_ptr_to_ptr.rs:42:27
@@ -38,10 +38,10 @@ LL | let _: &GenericParam<f32> = std::mem::transmute(&GenericParam { t:
3838 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam<u32> as *const GenericParam<f32>)`
3939
4040error: transmute from a reference to a reference
41- --> $DIR/transmute_ptr_to_ptr.rs:47:38
41+ --> $DIR/transmute_ptr_to_ptr.rs:47:36
4242 |
43- LL | let u64_ref : &u64 = unsafe { std::mem::transmute(u8_ref ) };
44- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u8_ref as *const u8 as *const u64 )`
43+ LL | let u8_ref : &u8 = unsafe { std::mem::transmute(u64_ref ) };
44+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8 )`
4545
4646error: aborting due to 7 previous errors
4747
You can’t perform that action at this time.
0 commit comments