From 94e83687390ba0f3cfefc6e0f9c6b00f42dfa48e Mon Sep 17 00:00:00 2001 From: CuriouslyCurious Date: Thu, 3 Aug 2023 00:50:04 +0200 Subject: [PATCH] Add `const` to new_unchecked() Signed-off-by: CuriouslyCurious --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 220af6b..c44b04b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -840,7 +840,7 @@ impl FlagSet { /// } /// /// // Unknown and invalid bits are retained. Behavior is undefined. - /// let set = unsafe { FlagSet::::new_unchecked(0b11101) }; + /// const set: FlagSet = unsafe { FlagSet::::new_unchecked(0b11101) }; /// assert_eq!(set.bits(), 0b11101); /// ``` /// @@ -849,7 +849,7 @@ impl FlagSet { /// This constructor doesn't check that the bits are valid. If you pass /// undefined flags, undefined behavior may result. #[inline] - pub unsafe fn new_unchecked(bits: F::Type) -> Self { + pub const unsafe fn new_unchecked(bits: F::Type) -> Self { FlagSet(bits) }