]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: num: bounded: add missing comment for always inlined function
authorAlexandre Courbot <acourbot@nvidia.com>
Mon, 8 Dec 2025 02:47:05 +0000 (11:47 +0900)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 18 Jan 2026 19:40:12 +0000 (20:40 +0100)
This code is always inlined to avoid a build error if the error path of
`build_assert` cannot be optimized out. Add a comment justifying the
`#[inline(always)]` property to avoid it being taken away by mistake.

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20251208-io-build-assert-v3-7-98aded02c1ea@nvidia.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/num/bounded.rs

index c9a44e12c19ba4d7c0f66ea5e09cc61ec35aac4e..5ef8361cf5d5a85cf6670f1d0b0556a3c6dd5137 100644 (file)
@@ -367,6 +367,7 @@ where
     /// assert_eq!(Bounded::<u8, 1>::from_expr(1).get(), 1);
     /// assert_eq!(Bounded::<u16, 8>::from_expr(0xff).get(), 0xff);
     /// ```
+    // Always inline to optimize out error path of `build_assert`.
     #[inline(always)]
     pub fn from_expr(expr: T) -> Self {
         crate::build_assert!(