Add a tracking issue for extra Layout methods
This commit is contained in:
@@ -119,6 +119,7 @@
|
|||||||
#![feature(const_vec_new)]
|
#![feature(const_vec_new)]
|
||||||
#![feature(slice_partition_dedup)]
|
#![feature(slice_partition_dedup)]
|
||||||
#![feature(maybe_uninit)]
|
#![feature(maybe_uninit)]
|
||||||
|
#![feature(alloc_layout_extra)]
|
||||||
|
|
||||||
// Allow testing this library
|
// Allow testing this library
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ impl Layout {
|
|||||||
/// Returns an error if the combination of `self.size()` and the given
|
/// Returns an error if the combination of `self.size()` and the given
|
||||||
/// `align` violates the conditions listed in
|
/// `align` violates the conditions listed in
|
||||||
/// [`Layout::from_size_align`](#method.from_size_align).
|
/// [`Layout::from_size_align`](#method.from_size_align).
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn align_to(&self, align: usize) -> Result<Self, LayoutErr> {
|
pub fn align_to(&self, align: usize) -> Result<Self, LayoutErr> {
|
||||||
Layout::from_size_align(self.size(), cmp::max(self.align(), align))
|
Layout::from_size_align(self.size(), cmp::max(self.align(), align))
|
||||||
@@ -189,7 +189,7 @@ impl Layout {
|
|||||||
/// to be less than or equal to the alignment of the starting
|
/// to be less than or equal to the alignment of the starting
|
||||||
/// address for the whole allocated block of memory. One way to
|
/// address for the whole allocated block of memory. One way to
|
||||||
/// satisfy this constraint is to ensure `align <= self.align()`.
|
/// satisfy this constraint is to ensure `align <= self.align()`.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn padding_needed_for(&self, align: usize) -> usize {
|
pub fn padding_needed_for(&self, align: usize) -> usize {
|
||||||
let len = self.size();
|
let len = self.size();
|
||||||
@@ -226,7 +226,7 @@ impl Layout {
|
|||||||
/// of each element in the array.
|
/// of each element in the array.
|
||||||
///
|
///
|
||||||
/// On arithmetic overflow, returns `LayoutErr`.
|
/// On arithmetic overflow, returns `LayoutErr`.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
|
pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
|
||||||
let padded_size = self.size().checked_add(self.padding_needed_for(self.align()))
|
let padded_size = self.size().checked_add(self.padding_needed_for(self.align()))
|
||||||
@@ -255,7 +255,7 @@ impl Layout {
|
|||||||
/// (assuming that the record itself starts at offset 0).
|
/// (assuming that the record itself starts at offset 0).
|
||||||
///
|
///
|
||||||
/// On arithmetic overflow, returns `LayoutErr`.
|
/// On arithmetic overflow, returns `LayoutErr`.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn extend(&self, next: Self) -> Result<(Self, usize), LayoutErr> {
|
pub fn extend(&self, next: Self) -> Result<(Self, usize), LayoutErr> {
|
||||||
let new_align = cmp::max(self.align(), next.align());
|
let new_align = cmp::max(self.align(), next.align());
|
||||||
@@ -282,7 +282,7 @@ impl Layout {
|
|||||||
/// aligned.
|
/// aligned.
|
||||||
///
|
///
|
||||||
/// On arithmetic overflow, returns `LayoutErr`.
|
/// On arithmetic overflow, returns `LayoutErr`.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutErr> {
|
pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutErr> {
|
||||||
let size = self.size().checked_mul(n).ok_or(LayoutErr { private: () })?;
|
let size = self.size().checked_mul(n).ok_or(LayoutErr { private: () })?;
|
||||||
@@ -295,7 +295,7 @@ impl Layout {
|
|||||||
/// and is not incorporated *at all* into the resulting layout.
|
/// and is not incorporated *at all* into the resulting layout.
|
||||||
///
|
///
|
||||||
/// On arithmetic overflow, returns `LayoutErr`.
|
/// On arithmetic overflow, returns `LayoutErr`.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn extend_packed(&self, next: Self) -> Result<Self, LayoutErr> {
|
pub fn extend_packed(&self, next: Self) -> Result<Self, LayoutErr> {
|
||||||
let new_size = self.size().checked_add(next.size())
|
let new_size = self.size().checked_add(next.size())
|
||||||
@@ -307,7 +307,7 @@ impl Layout {
|
|||||||
/// Creates a layout describing the record for a `[T; n]`.
|
/// Creates a layout describing the record for a `[T; n]`.
|
||||||
///
|
///
|
||||||
/// On arithmetic overflow, returns `LayoutErr`.
|
/// On arithmetic overflow, returns `LayoutErr`.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn array<T>(n: usize) -> Result<Self, LayoutErr> {
|
pub fn array<T>(n: usize) -> Result<Self, LayoutErr> {
|
||||||
Layout::new::<T>()
|
Layout::new::<T>()
|
||||||
|
|||||||
@@ -310,6 +310,7 @@
|
|||||||
#![feature(doc_keyword)]
|
#![feature(doc_keyword)]
|
||||||
#![feature(panic_info_message)]
|
#![feature(panic_info_message)]
|
||||||
#![feature(non_exhaustive)]
|
#![feature(non_exhaustive)]
|
||||||
|
#![feature(alloc_layout_extra)]
|
||||||
|
|
||||||
#![default_lib_allocator]
|
#![default_lib_allocator]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user