Commit 2af6ad09 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Miguel Ojeda
Browse files

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: default avatarDaniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20251208-io-build-assert-v3-7-98aded02c1ea@nvidia.com


Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent d6ff6e87
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -367,6 +367,7 @@ pub fn try_new(value: T) -> Option<Self> {
    /// 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!(