diff options
| author | bors <bors@rust-lang.org> | 2018-12-06 10:18:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-12-06 10:18:17 +0000 |
| commit | 128a1fa4e1f85e04f522653bb9bee83ed6523440 (patch) | |
| tree | cf1bb66e041bed563653ac45ea58bfa863d7518a /src/libcore/num | |
| parent | 77a6a61f066af3dd693d8527a8a1bf5a446d295c (diff) | |
| parent | cb71752f911c47426e208a9f5f1862d4c0e56aa4 (diff) | |
| download | rust-128a1fa4e1f85e04f522653bb9bee83ed6523440.tar.gz rust-128a1fa4e1f85e04f522653bb9bee83ed6523440.zip | |
Auto merge of #55635 - oli-obk:min_const_unsafe_fn, r=nikomatsakis
Allow calling `const unsafe fn` in `const fn` behind a feature gate cc #55607 r? @Centril
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 805be431328..7f5d596b220 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -70,7 +70,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st #[stable(feature = "nonzero", since = "1.28.0")] #[inline] pub const unsafe fn new_unchecked(n: $Int) -> Self { - $Ty(NonZero(n)) + $Ty(unsafe { NonZero(n) }) } /// Create a non-zero if the given value is not zero. @@ -78,7 +78,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st #[inline] pub fn new(n: $Int) -> Option<Self> { if n != 0 { - Some($Ty(NonZero(n))) + Some($Ty(unsafe { NonZero(n) })) } else { None } |
