diff options
| author | Gary Guo <gary@garyguo.net> | 2023-04-14 01:22:14 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2023-11-25 23:58:51 +0000 |
| commit | 97c1502066349973943c0b3bb3d5810ef999856e (patch) | |
| tree | 8672303f9d9059db678d88d6007374faf863a8d3 /library/core/src/ptr/alignment.rs | |
| parent | 4ccec4558fea4c649ef92874bb26f3e96ab8eb21 (diff) | |
| download | rust-97c1502066349973943c0b3bb3d5810ef999856e.tar.gz rust-97c1502066349973943c0b3bb3d5810ef999856e.zip | |
Convert many `assert_unsafe_precondition` to `debug_assert_nounwind`
Diffstat (limited to 'library/core/src/ptr/alignment.rs')
| -rw-r--r-- | library/core/src/ptr/alignment.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs index e578d2257f6..ce176e6fc18 100644 --- a/library/core/src/ptr/alignment.rs +++ b/library/core/src/ptr/alignment.rs @@ -1,5 +1,4 @@ use crate::convert::{TryFrom, TryInto}; -use crate::intrinsics::assert_unsafe_precondition; use crate::num::NonZeroUsize; use crate::{cmp, fmt, hash, mem, num}; @@ -77,13 +76,10 @@ impl Alignment { #[rustc_const_unstable(feature = "ptr_alignment_type", issue = "102070")] #[inline] pub const unsafe fn new_unchecked(align: usize) -> Self { - // SAFETY: Precondition passed to the caller. - unsafe { - assert_unsafe_precondition!( - "Alignment::new_unchecked requires a power of two", - (align: usize) => align.is_power_of_two() - ) - }; + crate::panic::debug_assert_nounwind!( + align.is_power_of_two(), + "Alignment::new_unchecked requires a power of two" + ); // SAFETY: By precondition, this must be a power of two, and // our variants encompass all possible powers of two. |
