diff options
| author | James Wainwright <james.wainwright@lowrisc.org> | 2025-03-25 21:43:19 +0000 |
|---|---|---|
| committer | James Wainwright <james.wainwright@lowrisc.org> | 2025-03-26 21:41:11 +0000 |
| commit | 78e962139020df03174f03da6af91acc5cbb37e3 (patch) | |
| tree | 40ebedad64554c4440f523b6203965d452531046 /library/core/src/alloc/layout.rs | |
| parent | d872845eae7f9988995fb8ca35f86d08de999409 (diff) | |
| download | rust-78e962139020df03174f03da6af91acc5cbb37e3.tar.gz rust-78e962139020df03174f03da6af91acc5cbb37e3.zip | |
Pass `Alignment` for `RawVecInner::new_in`
Encodes the safety constraint that `Unique`'s pointer must be non-zero into the API.
Diffstat (limited to 'library/core/src/alloc/layout.rs')
| -rw-r--r-- | library/core/src/alloc/layout.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 1595a3af883..e8a03aadc33 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -520,6 +520,14 @@ impl Layout { unsafe { Ok(Layout::from_size_align_unchecked(array_size, align.as_usize())) } } } + + /// Perma-unstable access to `align` as `Alignment` type. + #[unstable(issue = "none", feature = "std_internals")] + #[doc(hidden)] + #[inline] + pub const fn alignment(&self) -> Alignment { + self.align + } } #[stable(feature = "alloc_layout", since = "1.28.0")] |
