Commit bc10d84ed1 for qemu.org
commit bc10d84ed148eaf7f59b167f36bbc8a06a662823
Author: Samuel Tardieu <sam@rfc1149.net>
Date: Sat Nov 14 11:01:14 2026 +0100
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.
Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Link: https://lore.kernel.org/r/20261114-rust-single-bit-v1-1-da0172820f84@rfc1149.net
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/rust/common/src/bitops.rs b/rust/common/src/bitops.rs
index 06c78c3b8a..a0aff75d76 100644
--- a/rust/common/src/bitops.rs
+++ b/rust/common/src/bitops.rs
@@ -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]