rust/common: rename IntegerExt::bit() to single_bit()
PATCH 1/1 rust/common: rename IntegerExt::bit() to single_bit()
An experimental Rust nightly feature get_set_bit introduces a bit() method on integer types which checks whether a specific bit is set. This clashes with QEMU's IntegerExt::bit() associated function which returns an integer with one particular bit set.
While the get_set_bit feature has no planned stabilization date yet, this is reported as a unstable_name_collisions warning when compiling with the strict_rust_lints option, and warnings are turned into errors. Renaming IntegerExt::bit() to IntegerExt::single_bit() prevents this.
--- rust/common/src/bitops.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
rust/common/src/bitops.rs +4 -4
@@ -34,7 +34,7 @@ pub trait IntegerExt:#[inline] #[must_use] -fn bit (start:u32 ) ->Self +fn single_bit (start:u32 ) ->Self {debug_assert! (start <Self ::BITS );
@@ -105,9 +105,9 @@ fn test_extract() { }#[test] -fn test_bit () { -assert_eq! (u8 ::bit (7 ),128 ); -assert_eq! (u32 ::bit (16 ),0x10000 ); +fn test_single_bit () { +assert_eq! (u8 ::single_bit (7 ),128 ); +assert_eq! (u32 ::single_bit (16 ),0x10000 ); }#[test]
---
base-commit: e9fa1f66f0d47c74b6766e1b8b87ad7c2a9394d5
change-id: 20261114-rust-single-bit-60366e5998ff
Best regards,
Signature · 1 line
Samuel Tardieu <[email protected]>
Quoted 6 lines · Samuel Tardieu
An experimental Rust nightly feature
get_set_bitintroduces abit()method on integer types which checks whether a specific bit is set. This clashes with QEMU'sIntegerExt::bit()associated function which returns an integer with one particular bit set.
Quoted 6 lines
While the
get_set_bitfeature has no planned stabilization date yet, this is reported as aunstable_name_collisionswarning when compiling with thestrict_rust_lintsoption, and warnings are turned into errors. RenamingIntegerExt::bit()toIntegerExt::single_bit()prevents this.Signed-off-by Samuel Tardieu <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4842
thanks
-- PMM
Paolo Bonzini
AppliedQueued, thanks.
Paolo