rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

call to unsafe function `std::intrinsics::transmute` is unsafe and requires unsafe block

Open JMS55 opened this issue 5 months ago • 0 comments

When compiling https://github.com/JMS55/dlss_wgpu/tree/deabf142d371b0f7700afc2741b9b43eb670b286.

warning[E0133]: call to unsafe function `std::intrinsics::transmute` is unsafe and requires unsafe block
  --> D:\dlss_wgpu\target\debug\build\dlss_wgpu-6adfd00d523bab83\out/bindings.rs:12:9
   |
12 |         ::std::mem::transmute(self)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
   = note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
  --> D:\dlss_wgpu\target\debug\build\dlss_wgpu-6adfd00d523bab83\out/bindings.rs:11:5
   |
11 |     pub unsafe fn as_ref(&self) -> &T {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default

warning[E0133]: call to unsafe function `std::intrinsics::transmute` is unsafe and requires unsafe block
  --> D:\dlss_wgpu\target\debug\build\dlss_wgpu-6adfd00d523bab83\out/bindings.rs:16:9
   |
16 |         ::std::mem::transmute(self)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
   = note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
  --> D:\dlss_wgpu\target\debug\build\dlss_wgpu-6adfd00d523bab83\out/bindings.rs:15:5
   |
15 |     pub unsafe fn as_mut(&mut self) -> &mut T {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0133`.

JMS55 avatar Jul 08 '25 14:07 JMS55