Skip to content

Commit 0b20ce9

Browse files
Make num::NonZeroX::new an unstable const fn
1 parent a29424a commit 0b20ce9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libcore/num/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
6969

7070
/// Creates a non-zero if the given value is not zero.
7171
#[$stability]
72+
#[rustc_const_unstable(feature = "const_nonzero_int_methods", issue = "53718")]
7273
#[inline]
73-
pub fn new(n: $Int) -> Option<Self> {
74+
pub const fn new(n: $Int) -> Option<Self> {
7475
if n != 0 {
7576
// SAFETY: we just checked that there's no `0`
7677
Some(unsafe { Self(n) })

0 commit comments

Comments
 (0)