diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-02-08 16:02:20 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-02-08 16:02:20 -0800 |
| commit | 0b20ce97f7cc1360190cb9c2b102cdee4f487de2 (patch) | |
| tree | 7d956b535b8cbc72890625ce9d8c7d45ba269181 /src | |
| parent | a29424a2265411dda7d7446516ac5fd7499e2b55 (diff) | |
| download | rust-0b20ce97f7cc1360190cb9c2b102cdee4f487de2.tar.gz rust-0b20ce97f7cc1360190cb9c2b102cdee4f487de2.zip | |
Make `num::NonZeroX::new` an unstable `const fn`
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/num/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index ed37b48b3e8..3ae8f0f7870 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -69,8 +69,9 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s /// Creates a non-zero if the given value is not zero. #[$stability] + #[rustc_const_unstable(feature = "const_nonzero_int_methods", issue = "53718")] #[inline] - pub fn new(n: $Int) -> Option<Self> { + pub const fn new(n: $Int) -> Option<Self> { if n != 0 { // SAFETY: we just checked that there's no `0` Some(unsafe { Self(n) }) |
