summary refs log tree commit diff
path: root/library/core/src/mem
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-19 14:06:23 +0000
committerbors <bors@rust-lang.org>2022-09-19 14:06:23 +0000
commita55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52 (patch)
tree2de5a3c571f7f5b54f4922b644f72f33786eb0e0 /library/core/src/mem
parentb31188e88b245f48b364c6cb186b821bd472bd8a (diff)
parent7358a9b03e5d22ea4d74d89cb00d3985fc89c773 (diff)
downloadrust-1.64.0.tar.gz
rust-1.64.0.zip
Auto merge of #102018 - pietroalbini:pa-1.64.0, r=pietroalbini 1.64.0
[stable] Prepare 1.64.0 release

This PR prepares the 1.64.0 stable release builds.

In addition to bumping the channel and including the latest release notes changes, this PR also backports the following PRs:

*  #100852
*  #101366
*  #101468
*  #101922

This PR also reverts the following PRs, as decided in https://github.com/rust-lang/rust/issues/101899#issuecomment-1250996783:

* https://github.com/rust-lang/rust/pull/95295
* https://github.com/rust-lang/rust/pull/99136 (followup to the previous PR)

r? `@ghost`
cc `@rust-lang/release`
Diffstat (limited to 'library/core/src/mem')
-rw-r--r--library/core/src/mem/valid_align.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/library/core/src/mem/valid_align.rs b/library/core/src/mem/valid_align.rs
index 4ce6d13cf90..fcfa95120df 100644
--- a/library/core/src/mem/valid_align.rs
+++ b/library/core/src/mem/valid_align.rs
@@ -1,5 +1,4 @@
 use crate::convert::TryFrom;
-use crate::intrinsics::assert_unsafe_precondition;
 use crate::num::NonZeroUsize;
 use crate::{cmp, fmt, hash, mem, num};
 
@@ -27,8 +26,7 @@ impl ValidAlign {
     /// It must *not* be zero.
     #[inline]
     pub(crate) const unsafe fn new_unchecked(align: usize) -> Self {
-        // SAFETY: Precondition passed to the caller.
-        unsafe { assert_unsafe_precondition!(align.is_power_of_two()) };
+        debug_assert!(align.is_power_of_two());
 
         // SAFETY: By precondition, this must be a power of two, and
         // our variants encompass all possible powers of two.
@@ -48,13 +46,6 @@ impl ValidAlign {
     pub(crate) fn log2(self) -> u32 {
         self.as_nonzero().trailing_zeros()
     }
-
-    /// Returns the alignment for a type.
-    #[inline]
-    pub(crate) fn of<T>() -> Self {
-        // SAFETY: rustc ensures that type alignment is always a power of two.
-        unsafe { ValidAlign::new_unchecked(mem::align_of::<T>()) }
-    }
 }
 
 impl fmt::Debug for ValidAlign {