about summary refs log tree commit diff
path: root/library/core/src/ptr
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2022-09-21 13:43:21 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2022-09-21 13:43:21 -0700
commite2d7cdcf2badf4d8d2d89dadb65a32a2eba01aff (patch)
treea859124a4e0ea374ce965f1c13747cb8bf8593f3 /library/core/src/ptr
parent585bcc69807b3730e3de11c5dbceccbab12e874d (diff)
downloadrust-e2d7cdcf2badf4d8d2d89dadb65a32a2eba01aff.tar.gz
rust-e2d7cdcf2badf4d8d2d89dadb65a32a2eba01aff.zip
Add `rustc_allow_const_fn_unstable` annotations to pre-existing `Layout` methods
Diffstat (limited to 'library/core/src/ptr')
-rw-r--r--library/core/src/ptr/alignment.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs
index 5e7628c5a18..d0df316c770 100644
--- a/library/core/src/ptr/alignment.rs
+++ b/library/core/src/ptr/alignment.rs
@@ -24,7 +24,7 @@ impl Alignment {
     /// but in an `Alignment` instead of a `usize.
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
     #[inline]
-    pub(crate) fn of<T>() -> Self {
+    pub const fn of<T>() -> Self {
         // SAFETY: rustc ensures that type alignment is always a power of two.
         unsafe { Alignment::new_unchecked(mem::align_of::<T>()) }
     }
@@ -53,6 +53,7 @@ impl Alignment {
     /// Equivalently, it must be `1 << exp` for some `exp` in `0..usize::BITS`.
     /// It must *not* be zero.
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
+    #[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.
@@ -65,6 +66,7 @@ impl Alignment {
 
     /// Returns the alignment as a [`NonZeroUsize`]
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
+    #[rustc_const_unstable(feature = "ptr_alignment_type", issue = "102070")]
     #[inline]
     pub const fn as_usize(self) -> usize {
         self.0 as usize