diff options
| author | Tim Diekmann <tim.diekmann@3dvision.de> | 2020-01-23 01:49:29 +0100 |
|---|---|---|
| committer | Tim Diekmann <tim.diekmann@3dvision.de> | 2020-01-27 21:39:51 +0100 |
| commit | 7ca25db8162128808714f536fa993aefcf6a2239 (patch) | |
| tree | b0e326ad284fb34d208b59080a38e349a50687b0 /src/liballoc | |
| parent | c2d141df59703393c0c683abc259f9a8c3be041a (diff) | |
| download | rust-7ca25db8162128808714f536fa993aefcf6a2239.tar.gz rust-7ca25db8162128808714f536fa993aefcf6a2239.zip | |
Rename `Alloc` to `AllocRef`
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/alloc.rs | 22 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/collections/btree/node.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/raw_vec.rs | 16 | ||||
| -rw-r--r-- | src/liballoc/raw_vec/tests.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/tests/heap.rs | 4 |
8 files changed, 26 insertions, 26 deletions
diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs index 0c0dc928b95..9fb0de63e6f 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -31,14 +31,14 @@ extern "Rust" { /// The global memory allocator. /// -/// This type implements the [`Alloc`] trait by forwarding calls +/// This type implements the [`AllocRef`] trait by forwarding calls /// to the allocator registered with the `#[global_allocator]` attribute /// if there is one, or the `std` crate’s default. /// /// Note: while this type is unstable, the functionality it provides can be /// accessed through the [free functions in `alloc`](index.html#functions). /// -/// [`Alloc`]: trait.Alloc.html +/// [`AllocRef`]: trait.AllocRef.html #[unstable(feature = "allocator_api", issue = "32838")] #[derive(Copy, Clone, Default, Debug)] pub struct Global; @@ -50,14 +50,14 @@ pub struct Global; /// if there is one, or the `std` crate’s default. /// /// This function is expected to be deprecated in favor of the `alloc` method -/// of the [`Global`] type when it and the [`Alloc`] trait become stable. +/// of the [`Global`] type when it and the [`AllocRef`] trait become stable. /// /// # Safety /// /// See [`GlobalAlloc::alloc`]. /// /// [`Global`]: struct.Global.html -/// [`Alloc`]: trait.Alloc.html +/// [`AllocRef`]: trait.AllocRef.html /// [`GlobalAlloc::alloc`]: trait.GlobalAlloc.html#tymethod.alloc /// /// # Examples @@ -88,14 +88,14 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 { /// if there is one, or the `std` crate’s default. /// /// This function is expected to be deprecated in favor of the `dealloc` method -/// of the [`Global`] type when it and the [`Alloc`] trait become stable. +/// of the [`Global`] type when it and the [`AllocRef`] trait become stable. /// /// # Safety /// /// See [`GlobalAlloc::dealloc`]. /// /// [`Global`]: struct.Global.html -/// [`Alloc`]: trait.Alloc.html +/// [`AllocRef`]: trait.AllocRef.html /// [`GlobalAlloc::dealloc`]: trait.GlobalAlloc.html#tymethod.dealloc #[stable(feature = "global_alloc", since = "1.28.0")] #[inline] @@ -110,14 +110,14 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) { /// if there is one, or the `std` crate’s default. /// /// This function is expected to be deprecated in favor of the `realloc` method -/// of the [`Global`] type when it and the [`Alloc`] trait become stable. +/// of the [`Global`] type when it and the [`AllocRef`] trait become stable. /// /// # Safety /// /// See [`GlobalAlloc::realloc`]. /// /// [`Global`]: struct.Global.html -/// [`Alloc`]: trait.Alloc.html +/// [`AllocRef`]: trait.AllocRef.html /// [`GlobalAlloc::realloc`]: trait.GlobalAlloc.html#method.realloc #[stable(feature = "global_alloc", since = "1.28.0")] #[inline] @@ -132,14 +132,14 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 /// if there is one, or the `std` crate’s default. /// /// This function is expected to be deprecated in favor of the `alloc_zeroed` method -/// of the [`Global`] type when it and the [`Alloc`] trait become stable. +/// of the [`Global`] type when it and the [`AllocRef`] trait become stable. /// /// # Safety /// /// See [`GlobalAlloc::alloc_zeroed`]. /// /// [`Global`]: struct.Global.html -/// [`Alloc`]: trait.Alloc.html +/// [`AllocRef`]: trait.AllocRef.html /// [`GlobalAlloc::alloc_zeroed`]: trait.GlobalAlloc.html#method.alloc_zeroed /// /// # Examples @@ -163,7 +163,7 @@ pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 { } #[unstable(feature = "allocator_api", issue = "32838")] -unsafe impl Alloc for Global { +unsafe impl AllocRef for Global { #[inline] unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> { NonNull::new(alloc(layout)).ok_or(AllocErr) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 87a4924f9be..8735c2c8f36 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -145,7 +145,7 @@ use core::ptr::{self, NonNull, Unique}; use core::slice; use core::task::{Context, Poll}; -use crate::alloc::{self, Alloc, Global}; +use crate::alloc::{self, AllocRef, Global}; use crate::raw_vec::RawVec; use crate::str::from_boxed_utf8_unchecked; use crate::vec::Vec; diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index d9cdebb4f73..c0a96e89366 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -36,7 +36,7 @@ use core::mem::{self, MaybeUninit}; use core::ptr::{self, NonNull, Unique}; use core::slice; -use crate::alloc::{Alloc, Global, Layout}; +use crate::alloc::{AllocRef, Global, Layout}; use crate::boxed::Box; const B: usize = 6; diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 86aed612efe..e1b549bed18 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -7,7 +7,7 @@ use core::ops::Drop; use core::ptr::{self, NonNull, Unique}; use core::slice; -use crate::alloc::{handle_alloc_error, Alloc, AllocErr, Global, Layout}; +use crate::alloc::{handle_alloc_error, AllocErr, AllocRef, Global, Layout}; use crate::boxed::Box; use crate::collections::TryReserveError::{self, *}; @@ -42,13 +42,13 @@ mod tests; /// field. This allows zero-sized types to not be special-cased by consumers of /// this type. #[allow(missing_debug_implementations)] -pub struct RawVec<T, A: Alloc = Global> { +pub struct RawVec<T, A: AllocRef = Global> { ptr: Unique<T>, cap: usize, a: A, } -impl<T, A: Alloc> RawVec<T, A> { +impl<T, A: AllocRef> RawVec<T, A> { /// Like `new`, but parameterized over the choice of allocator for /// the returned `RawVec`. pub const fn new_in(a: A) -> Self { @@ -147,7 +147,7 @@ impl<T> RawVec<T, Global> { } } -impl<T, A: Alloc> RawVec<T, A> { +impl<T, A: AllocRef> RawVec<T, A> { /// Reconstitutes a `RawVec` from a pointer, capacity, and allocator. /// /// # Undefined Behavior @@ -182,7 +182,7 @@ impl<T> RawVec<T, Global> { } } -impl<T, A: Alloc> RawVec<T, A> { +impl<T, A: AllocRef> RawVec<T, A> { /// Gets a raw pointer to the start of the allocation. Note that this is /// `Unique::empty()` if `capacity == 0` or `T` is zero-sized. In the former case, you must /// be careful. @@ -622,7 +622,7 @@ enum ReserveStrategy { use ReserveStrategy::*; -impl<T, A: Alloc> RawVec<T, A> { +impl<T, A: AllocRef> RawVec<T, A> { fn reserve_internal( &mut self, used_capacity: usize, @@ -700,7 +700,7 @@ impl<T> RawVec<T, Global> { } } -impl<T, A: Alloc> RawVec<T, A> { +impl<T, A: AllocRef> RawVec<T, A> { /// Frees the memory owned by the `RawVec` *without* trying to drop its contents. pub unsafe fn dealloc_buffer(&mut self) { let elem_size = mem::size_of::<T>(); @@ -712,7 +712,7 @@ impl<T, A: Alloc> RawVec<T, A> { } } -unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec<T, A> { +unsafe impl<#[may_dangle] T, A: AllocRef> Drop for RawVec<T, A> { /// Frees the memory owned by the `RawVec` *without* trying to drop its contents. fn drop(&mut self) { unsafe { diff --git a/src/liballoc/raw_vec/tests.rs b/src/liballoc/raw_vec/tests.rs index b214cef3011..63087501f0e 100644 --- a/src/liballoc/raw_vec/tests.rs +++ b/src/liballoc/raw_vec/tests.rs @@ -19,7 +19,7 @@ fn allocator_param() { struct BoundedAlloc { fuel: usize, } - unsafe impl Alloc for BoundedAlloc { + unsafe impl AllocRef for BoundedAlloc { unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> { let size = layout.size(); if size > self.fuel { diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index b176e0f6e2a..9dc5447397f 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -252,7 +252,7 @@ use core::ptr::{self, NonNull}; use core::slice::{self, from_raw_parts_mut}; use core::usize; -use crate::alloc::{box_free, handle_alloc_error, Alloc, Global, Layout}; +use crate::alloc::{box_free, handle_alloc_error, AllocRef, Global, Layout}; use crate::string::String; use crate::vec::Vec; diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 4aa0190b149..fd285242d5b 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -25,7 +25,7 @@ use core::sync::atomic; use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst}; use core::{isize, usize}; -use crate::alloc::{box_free, handle_alloc_error, Alloc, Global, Layout}; +use crate::alloc::{box_free, handle_alloc_error, AllocRef, Global, Layout}; use crate::boxed::Box; use crate::rc::is_dangling; use crate::string::String; diff --git a/src/liballoc/tests/heap.rs b/src/liballoc/tests/heap.rs index 43cd7187823..7fcfcf9b294 100644 --- a/src/liballoc/tests/heap.rs +++ b/src/liballoc/tests/heap.rs @@ -1,4 +1,4 @@ -use std::alloc::{Alloc, Global, Layout, System}; +use std::alloc::{AllocRef, Global, Layout, System}; /// Issue #45955 and #62251. #[test] @@ -11,7 +11,7 @@ fn std_heap_overaligned_request() { check_overalign_requests(Global) } -fn check_overalign_requests<T: Alloc>(mut allocator: T) { +fn check_overalign_requests<T: AllocRef>(mut allocator: T) { for &align in &[4, 8, 16, 32] { // less than and bigger than `MIN_ALIGN` for &size in &[align / 2, align - 1] { |
