about summary refs log tree commit diff
path: root/library/core/src/alloc
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/alloc
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/alloc')
-rw-r--r--library/core/src/alloc/layout.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs
index f03502429ab..03681a16b9d 100644
--- a/library/core/src/alloc/layout.rs
+++ b/library/core/src/alloc/layout.rs
@@ -65,6 +65,7 @@ impl Layout {
     #[stable(feature = "alloc_layout", since = "1.28.0")]
     #[rustc_const_stable(feature = "const_alloc_layout_size_align", since = "1.50.0")]
     #[inline]
+    #[rustc_allow_const_fn_unstable(ptr_alignment_type)]
     pub const fn from_size_align(size: usize, align: usize) -> Result<Self, LayoutError> {
         if !align.is_power_of_two() {
             return Err(LayoutError);
@@ -114,6 +115,7 @@ impl Layout {
     #[rustc_const_stable(feature = "const_alloc_layout_unchecked", since = "1.36.0")]
     #[must_use]
     #[inline]
+    #[rustc_allow_const_fn_unstable(ptr_alignment_type)]
     pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
         // SAFETY: the caller is required to uphold the preconditions.
         unsafe { Layout { size, align: ValidAlign::new_unchecked(align) } }
@@ -134,6 +136,7 @@ impl Layout {
     #[must_use = "this returns the minimum alignment, \
                   without modifying the layout"]
     #[inline]
+    #[rustc_allow_const_fn_unstable(ptr_alignment_type)]
     pub const fn align(&self) -> usize {
         self.align.as_usize()
     }