about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-10-03 23:13:17 -0700
committerGitHub <noreply@github.com>2021-10-03 23:13:17 -0700
commite500f1c1e9de96edc3ac1ce1bccc0f241fa41c0a (patch)
tree37c5c37893cbf9b7667c84502ca015d8a7bfd943 /library
parent0f9e960241aa9f8c1c899ea5176ab71c04580cd8 (diff)
parent74c4c0172ab1f5c19fef69a163349a0a3f9cd927 (diff)
downloadrust-e500f1c1e9de96edc3ac1ce1bccc0f241fa41c0a.tar.gz
rust-e500f1c1e9de96edc3ac1ce1bccc0f241fa41c0a.zip
Rollup merge of #87910 - iago-lito:mark_unsafe_nonzero_arithmetics_as_const, r=joshtriplett
Mark unsafe methods NonZero*::unchecked_(add|mul) as const.

Now that https://github.com/rust-lang/rfcs/pull/3016 has landed, these two unstable `std` function can be marked `const`, according to this detail of #84186.
Diffstat (limited to 'library')
-rw-r--r--library/core/src/num/nonzero.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index dd9b9330aee..e44597279ba 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -379,7 +379,7 @@ macro_rules! nonzero_unsigned_operations {
                 /// ```
                 #[unstable(feature = "nonzero_ops", issue = "84186")]
                 #[inline]
-                pub unsafe fn unchecked_add(self, other: $Int) -> $Ty {
+                pub const unsafe fn unchecked_add(self, other: $Int) -> $Ty {
                     // SAFETY: The caller ensures there is no overflow.
                     unsafe { $Ty::new_unchecked(self.get().unchecked_add(other)) }
                 }
@@ -750,7 +750,7 @@ macro_rules! nonzero_unsigned_signed_operations {
                 /// ```
                 #[unstable(feature = "nonzero_ops", issue = "84186")]
                 #[inline]
-                pub unsafe fn unchecked_mul(self, other: $Ty) -> $Ty {
+                pub const unsafe fn unchecked_mul(self, other: $Ty) -> $Ty {
                     // SAFETY: The caller ensures there is no overflow.
                     unsafe { $Ty::new_unchecked(self.get().unchecked_mul(other.get())) }
                 }