summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2025-12-08 11:47:05 +0900
committerMiguel Ojeda <ojeda@kernel.org>2026-01-18 20:40:12 +0100
commit2af6ad09fc7dfe9b3610100983cccf16998bf34d (patch)
tree19b3f219268fc77a1df40dab374bf67f6aea3120 /rust
parentd6ff6e870077ae0f01a6f860ca1e4a5a825dc032 (diff)
rust: num: bounded: add missing comment for always inlined function
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>
Diffstat (limited to 'rust')
-rw-r--r--rust/kernel/num/bounded.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/rust/kernel/num/bounded.rs b/rust/kernel/num/bounded.rs
index c9a44e12c19b..5ef8361cf5d5 100644
--- a/rust/kernel/num/bounded.rs
+++ b/rust/kernel/num/bounded.rs
@@ -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!(