qemu-rust.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust/bindings: allow unnecessary_transmutes (1.88)
@ 2025-07-03 14:20 Manos Pitsidianakis
  2025-07-09 10:06 ` Bernhard Beschow
  0 siblings, 1 reply; 3+ messages in thread
From: Manos Pitsidianakis @ 2025-07-03 14:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-rust, Paolo Bonzini, Zhao Liu, Manos Pitsidianakis

This is a new lint introduced in Rust 1.88. It does not affect
compilation when using a previous version or our MSRV, 1.77. But with
1.88 compilation fails because we deny all warnings:

  error: unnecessary transmute
     --> rust/qemu-api/libqemu_api.rlib.p/structured/bindings.inc.rs:729:18
      |
  729 |         unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) }
      |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `u32::cast_signed(self._bitfield_1.get(0usize, 24u8) as u32)`
      |
      = note: `-D unnecessary-transmutes` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(unnecessary_transmutes)]`

Allow this lint, which even though it does not exist in previous
versions, it works because we allow for `unknown_lints` in
rust/Cargo.toml.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
---
 rust/qemu-api/src/bindings.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rust/qemu-api/src/bindings.rs b/rust/qemu-api/src/bindings.rs
index 057de4b6467c50ecc5acb6b51e6fde87ef5fa67f..3cdad0f0ec640880bc74a942bbcb303be4cda775 100644
--- a/rust/qemu-api/src/bindings.rs
+++ b/rust/qemu-api/src/bindings.rs
@@ -6,6 +6,7 @@
     non_camel_case_types,
     non_snake_case,
     non_upper_case_globals,
+    unnecessary_transmutes,
     unsafe_op_in_unsafe_fn,
     clippy::pedantic,
     clippy::restriction,

---
base-commit: c77283dd5d79149f4e7e9edd00f65416c648ee59
change-id: 20250703-rust_bindings_allow_unnecessary_transmutes-d614db4517a4

--
γαῖα πυρί μιχθήτω



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust/bindings: allow unnecessary_transmutes (1.88)
       [not found] <20250703-rust._5Fbindings._5Fallow._5Funnecessary._5Ftransmutes-v1-1-692ca210d331@linaro.org>
@ 2025-07-08  8:26 ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2025-07-08  8:26 UTC (permalink / raw)
  To: Manos Pitsidianakis; +Cc: qemu-devel, qemu-rust, Zhao Liu

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust/bindings: allow unnecessary_transmutes (1.88)
  2025-07-03 14:20 Manos Pitsidianakis
@ 2025-07-09 10:06 ` Bernhard Beschow
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Beschow @ 2025-07-09 10:06 UTC (permalink / raw)
  To: qemu-devel, Manos Pitsidianakis; +Cc: qemu-rust, Paolo Bonzini, Zhao Liu



Am 3. Juli 2025 14:20:22 UTC schrieb Manos Pitsidianakis <manos.pitsidianakis@linaro.org>:
>This is a new lint introduced in Rust 1.88. It does not affect
>compilation when using a previous version or our MSRV, 1.77. But with
>1.88 compilation fails because we deny all warnings:
>
>  error: unnecessary transmute
>     --> rust/qemu-api/libqemu_api.rlib.p/structured/bindings.inc.rs:729:18
>      |
>  729 |         unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) }
>      |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `u32::cast_signed(self._bitfield_1.get(0usize, 24u8) as u32)`
>      |
>      = note: `-D unnecessary-transmutes` implied by `-D warnings`
>      = help: to override `-D warnings` add `#[allow(unnecessary_transmutes)]`
>
>Allow this lint, which even though it does not exist in previous
>versions, it works because we allow for `unknown_lints` in
>rust/Cargo.toml.
>
>Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
>---
> rust/qemu-api/src/bindings.rs | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/rust/qemu-api/src/bindings.rs b/rust/qemu-api/src/bindings.rs
>index 057de4b6467c50ecc5acb6b51e6fde87ef5fa67f..3cdad0f0ec640880bc74a942bbcb303be4cda775 100644
>--- a/rust/qemu-api/src/bindings.rs
>+++ b/rust/qemu-api/src/bindings.rs
>@@ -6,6 +6,7 @@
>     non_camel_case_types,
>     non_snake_case,
>     non_upper_case_globals,
>+    unnecessary_transmutes,
>     unsafe_op_in_unsafe_fn,
>     clippy::pedantic,
>     clippy::restriction,
>
>---
>base-commit: c77283dd5d79149f4e7e9edd00f65416c648ee59
>change-id: 20250703-rust_bindings_allow_unnecessary_transmutes-d614db4517a4
>
>--
>γαῖα πυρί μιχθήτω
>
>

FWIW:

Reviewed-by: Bernhard Beschow <shentey@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-09 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250703-rust._5Fbindings._5Fallow._5Funnecessary._5Ftransmutes-v1-1-692ca210d331@linaro.org>
2025-07-08  8:26 ` [PATCH] rust/bindings: allow unnecessary_transmutes (1.88) Paolo Bonzini
2025-07-03 14:20 Manos Pitsidianakis
2025-07-09 10:06 ` Bernhard Beschow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).