Skip to content

Commit

Permalink
feat: add const to new_unchecked()
Browse files Browse the repository at this point in the history
Signed-off-by: CuriouslyCurious <thecuriouslycurious@protonmail.com>
  • Loading branch information
CuriouslyCurious authored and rjzak committed Aug 26, 2023
1 parent c90f6e1 commit 3acd8b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ impl<F: Flags> FlagSet<F> {
/// }
///
/// // Unknown and invalid bits are retained. Behavior is undefined.
/// let set = unsafe { FlagSet::<Flag>::new_unchecked(0b11101) };
/// const set: FlagSet<Flag> = unsafe { FlagSet::<Flag>::new_unchecked(0b11101) };
/// assert_eq!(set.bits(), 0b11101);
/// ```
///
Expand All @@ -849,7 +849,7 @@ impl<F: Flags> FlagSet<F> {
/// 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)
}

Expand Down

0 comments on commit 3acd8b6

Please sign in to comment.