]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/transmute.stderr
New upstream version 1.23.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / transmute.stderr
index a571fed24f05d874e2eb9658c81ec3c4706d8de8..6504f55845dd314323183d9dd190f66941013678 100644 (file)
@@ -154,5 +154,53 @@ error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`)
 117 |         let _: *mut Usize = core::intrinsics::transmute(my_int());
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 25 previous errors
+error: transmute from a `u32` to a `char`
+   --> $DIR/transmute.rs:123:28
+    |
+123 |     let _: char = unsafe { std::mem::transmute(0_u32) };
+    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_u32).unwrap()`
+    |
+    = note: `-D transmute-int-to-char` implied by `-D warnings`
+
+error: transmute from a `i32` to a `char`
+   --> $DIR/transmute.rs:124:28
+    |
+124 |     let _: char = unsafe { std::mem::transmute(0_i32) };
+    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_i32 as u32).unwrap()`
+
+error: transmute from a `u8` to a `bool`
+   --> $DIR/transmute.rs:129:28
+    |
+129 |     let _: bool = unsafe { std::mem::transmute(0_u8) };
+    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0`
+    |
+    = note: `-D transmute-int-to-bool` implied by `-D warnings`
+
+error: transmute from a `u32` to a `f32`
+   --> $DIR/transmute.rs:134:27
+    |
+134 |     let _: f32 = unsafe { std::mem::transmute(0_u32) };
+    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)`
+    |
+    = note: `-D transmute-int-to-float` implied by `-D warnings`
+
+error: transmute from a `i32` to a `f32`
+   --> $DIR/transmute.rs:135:27
+    |
+135 |     let _: f32 = unsafe { std::mem::transmute(0_i32) };
+    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_i32 as u32)`
+
+error: transmute from a `&[u8]` to a `&str`
+   --> $DIR/transmute.rs:139:28
+    |
+139 |     let _: &str = unsafe { std::mem::transmute(b) };
+    |                            ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(b).unwrap()`
+    |
+    = note: `-D transmute-bytes-to-str` implied by `-D warnings`
+
+error: transmute from a `&mut [u8]` to a `&mut str`
+   --> $DIR/transmute.rs:140:32
+    |
+140 |     let _: &mut str = unsafe { std::mem::transmute(mb) };
+    |                                ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`