Skip to content

Commit 2af6ad0

Browse files
Gnurouojeda
authored andcommitted
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>
1 parent d6ff6e8 commit 2af6ad0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

rust/kernel/num/bounded.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ where
367367
/// assert_eq!(Bounded::<u8, 1>::from_expr(1).get(), 1);
368368
/// assert_eq!(Bounded::<u16, 8>::from_expr(0xff).get(), 0xff);
369369
/// ```
370+
// Always inline to optimize out error path of `build_assert`.
370371
#[inline(always)]
371372
pub fn from_expr(expr: T) -> Self {
372373
crate::build_assert!(

0 commit comments

Comments
 (0)