From e2d7cdcf2badf4d8d2d89dadb65a32a2eba01aff Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Wed, 21 Sep 2022 13:43:21 -0700 Subject: Add `rustc_allow_const_fn_unstable` annotations to pre-existing `Layout` methods --- library/core/src/alloc/layout.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'library/core/src/alloc') 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 { 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() } -- cgit 1.4.1-3-g733a5