diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-10-10 00:09:40 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-10 00:09:40 +0900 |
| commit | 38db483af750535774616810f1f8a4e6bdc17260 (patch) | |
| tree | b8fc769bd043f51b4aa34c4d53e90da181141b16 /library/core/src/alloc | |
| parent | d0f1cf5de77a3ffe584de17658fa501e4aea5770 (diff) | |
| parent | c158b7b7d03039027774b2aabcdb066c371b5d36 (diff) | |
| download | rust-38db483af750535774616810f1f8a4e6bdc17260.tar.gz rust-38db483af750535774616810f1f8a4e6bdc17260.zip | |
Rollup merge of #102072 - scottmcm:ptr-alignment-type, r=thomcc
Add `ptr::Alignment` type Essentially no new code here, just exposing the previously-`pub(crate)` `ValidAlign` type under the name from the ACP. ACP: https://github.com/rust-lang/libs-team/issues/108 Tracking Issue: https://github.com/rust-lang/rust/issues/102070 r? ``@ghost``
Diffstat (limited to 'library/core/src/alloc')
| -rw-r--r-- | library/core/src/alloc/layout.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 5bb44b40859..920e559cc4a 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -64,6 +64,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); @@ -113,6 +114,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) } } @@ -133,6 +135,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() } |
