]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: num: bounded: rename `try_into_bitint` to `try_into_bounded`
authorAlexandre Courbot <acourbot@nvidia.com>
Mon, 24 Nov 2025 13:50:02 +0000 (22:50 +0900)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 24 Nov 2025 15:38:23 +0000 (16:38 +0100)
This is a remnant from when `Bounded` was called `BitInt` which I didn't
rename. Fix this.

Fixes: 01e345e82ec3 ("rust: num: add Bounded integer wrapping type")
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20251124-bounded_fix-v1-1-d8e34e1c727f@nvidia.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/num/bounded.rs

index 92c41b2eb76069a694939f35140da3336befc61c..f870080af8ac0a9fe7460fa0edab3f73beeb4de2 100644 (file)
@@ -218,11 +218,11 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
 /// use kernel::num::{Bounded, TryIntoBounded};
 ///
 /// // Succeeds because `128` fits into 8 bits.
-/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bitint();
+/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
 /// assert_eq!(v.as_deref().copied(), Some(128));
 ///
 /// // Fails because `128` doesn't fits into 6 bits.
-/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bitint();
+/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
 /// assert_eq!(v, None);
 /// ```
 #[repr(transparent)]
@@ -498,18 +498,18 @@ where
 /// use kernel::num::{Bounded, TryIntoBounded};
 ///
 /// // Succeeds because `128` fits into 8 bits.
-/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bitint();
+/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
 /// assert_eq!(v.as_deref().copied(), Some(128));
 ///
 /// // Fails because `128` doesn't fits into 6 bits.
-/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bitint();
+/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
 /// assert_eq!(v, None);
 /// ```
 pub trait TryIntoBounded<T: Integer, const N: u32> {
     /// Attempts to convert `self` into a [`Bounded`] using `N` bits.
     ///
     /// Returns [`None`] if `self` does not fit into the target type.
-    fn try_into_bitint(self) -> Option<Bounded<T, N>>;
+    fn try_into_bounded(self) -> Option<Bounded<T, N>>;
 }
 
 /// Any integer value can be attempted to be converted into a [`Bounded`] of any size.
@@ -518,7 +518,7 @@ where
     T: Integer,
     U: TryInto<T>,
 {
-    fn try_into_bitint(self) -> Option<Bounded<T, N>> {
+    fn try_into_bounded(self) -> Option<Bounded<T, N>> {
         self.try_into().ok().and_then(Bounded::try_new)
     }
 }