Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Commit c693213

Browse files
committed
Use old name
1 parent 91d44ee commit c693213

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

src/alloc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub use liballoc::alloc::{handle_alloc_error, Layout};
1414
use std::alloc::System;
1515

1616
mod panic_adaptor;
17-
pub use self::panic_adaptor::PanicAdapter;
17+
pub use self::panic_adaptor::AbortAlloc;
1818

1919
/// Allocate memory with the global allocator.
2020
///

src/alloc/panic_adaptor.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@ use crate::alloc::*;
1717
///
1818
/// See the [module-level documentation](../../std/abort_adapter/index.html) for more.
1919
#[derive(Copy, Clone, Debug, Default)]
20-
pub struct PanicAdapter<Alloc>(pub Alloc);
20+
pub struct AbortAlloc<Alloc>(pub Alloc);
2121

22-
impl<B: BuildAllocRef> BuildAllocRef for PanicAdapter<B> {
23-
type Ref = PanicAdapter<B::Ref>;
22+
impl<B: BuildAllocRef> BuildAllocRef for AbortAlloc<B> {
23+
type Ref = AbortAlloc<B::Ref>;
2424

2525
unsafe fn build_alloc_ref(
2626
&mut self,
2727
ptr: NonNull<u8>,
2828
layout: Option<NonZeroLayout>,
2929
) -> Self::Ref {
30-
PanicAdapter(self.0.build_alloc_ref(ptr, layout))
30+
AbortAlloc(self.0.build_alloc_ref(ptr, layout))
3131
}
3232
}
3333

34-
impl<A: DeallocRef> DeallocRef for PanicAdapter<A> {
35-
type BuildAlloc = PanicAdapter<A::BuildAlloc>;
34+
impl<A: DeallocRef> DeallocRef for AbortAlloc<A> {
35+
type BuildAlloc = AbortAlloc<A::BuildAlloc>;
3636

3737
fn get_build_alloc(&mut self) -> Self::BuildAlloc {
38-
PanicAdapter(self.0.get_build_alloc())
38+
AbortAlloc(self.0.get_build_alloc())
3939
}
4040

4141
unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: NonZeroLayout) {
4242
self.0.dealloc(ptr, layout)
4343
}
4444
}
4545

46-
impl<A: AllocRef> AllocRef for PanicAdapter<A> {
46+
impl<A: AllocRef> AllocRef for AbortAlloc<A> {
4747
type Error = !;
4848

4949
fn alloc(&mut self, layout: NonZeroLayout) -> Result<NonNull<u8>, Self::Error> {
@@ -81,7 +81,7 @@ impl<A: AllocRef> AllocRef for PanicAdapter<A> {
8181
}
8282
}
8383

84-
impl<A: ReallocRef> ReallocRef for PanicAdapter<A> {
84+
impl<A: ReallocRef> ReallocRef for AbortAlloc<A> {
8585
unsafe fn realloc(
8686
&mut self,
8787
ptr: NonNull<u8>,

src/boxed.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
//! [`NonZeroLayout::for_value(&*value)`]: crate::alloc::NonZeroLayout::for_value
8080
8181
use crate::{
82-
alloc::{AllocRef, BuildAllocRef, DeallocRef, Global, NonZeroLayout, PanicAdapter},
82+
alloc::{AllocRef, BuildAllocRef, DeallocRef, Global, NonZeroLayout, AbortAlloc},
8383
clone::CloneIn,
8484
collections::CollectionAllocErr,
8585
raw_vec::RawVec,
@@ -104,7 +104,7 @@ use core::{
104104
/// A pointer type for heap allocation.
105105
///
106106
/// See the [module-level documentation](index.html) for more.
107-
pub struct Box<T: ?Sized, A: DeallocRef = PanicAdapter<Global>> {
107+
pub struct Box<T: ?Sized, A: DeallocRef = AbortAlloc<Global>> {
108108
ptr: Unique<T>,
109109
build_alloc: A::BuildAlloc,
110110
}
@@ -130,7 +130,7 @@ impl<T> Box<T> {
130130
#[inline(always)]
131131
#[must_use]
132132
pub fn new(x: T) -> Self {
133-
Self::new_in(x, PanicAdapter(Global))
133+
Self::new_in(x, AbortAlloc(Global))
134134
}
135135

136136
/// Constructs a new box with uninitialized contents.
@@ -155,7 +155,7 @@ impl<T> Box<T> {
155155
#[inline(always)]
156156
#[must_use]
157157
pub fn new_uninit() -> Box<mem::MaybeUninit<T>> {
158-
Self::new_uninit_in(PanicAdapter(Global))
158+
Self::new_uninit_in(AbortAlloc(Global))
159159
}
160160

161161
/// Constructs a new `Pin<Box<T>>`. If `T` does not implement `Unpin`, then
@@ -320,7 +320,7 @@ impl<T> Box<[T]> {
320320
#[inline(always)]
321321
#[must_use]
322322
pub fn new_uninit_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> {
323-
Self::new_uninit_slice_in(len, PanicAdapter(Global))
323+
Self::new_uninit_slice_in(len, AbortAlloc(Global))
324324
}
325325
}
326326

@@ -522,7 +522,7 @@ impl<T: ?Sized> Box<T> {
522522
#[allow(clippy::inline_always)]
523523
#[inline(always)]
524524
pub unsafe fn from_raw(raw: *mut T) -> Self {
525-
Self::from_raw_in(raw, PanicAdapter(Global))
525+
Self::from_raw_in(raw, AbortAlloc(Global))
526526
}
527527
}
528528

src/raw_vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
DeallocRef,
77
Global,
88
NonZeroLayout,
9-
PanicAdapter,
9+
AbortAlloc,
1010
ReallocRef,
1111
},
1212
boxed::Box,
@@ -50,7 +50,7 @@ use core::{
5050
/// field. This allows zero-sized types to not be special-cased by consumers of
5151
/// this type.
5252
// Using `NonNull` + `PhantomData` instead of `Unique` to stay on stable as long as possible
53-
pub struct RawVec<T, A: DeallocRef = PanicAdapter<Global>> {
53+
pub struct RawVec<T, A: DeallocRef = AbortAlloc<Global>> {
5454
ptr: Unique<T>,
5555
capacity: usize,
5656
build_alloc: A::BuildAlloc,
@@ -88,7 +88,7 @@ impl<T> RawVec<T> {
8888
ptr: Unique::empty(),
8989
// FIXME(mark-i-m): use `cap` when ifs are allowed in const
9090
capacity: [0, !0][(mem::size_of::<T>() == 0) as usize],
91-
build_alloc: PanicAdapter(Global),
91+
build_alloc: AbortAlloc(Global),
9292
}
9393
}
9494

@@ -109,7 +109,7 @@ impl<T> RawVec<T> {
109109
#[inline]
110110
#[must_use]
111111
pub fn with_capacity(capacity: usize) -> Self {
112-
Self::with_capacity_in(capacity, PanicAdapter(Global))
112+
Self::with_capacity_in(capacity, AbortAlloc(Global))
113113
}
114114

115115
/// Like `with_capacity`, but guarantees the buffer is zeroed.
@@ -125,7 +125,7 @@ impl<T> RawVec<T> {
125125
#[inline]
126126
#[must_use]
127127
pub fn with_capacity_zeroed(capacity: usize) -> Self {
128-
Self::with_capacity_zeroed_in(capacity, PanicAdapter(Global))
128+
Self::with_capacity_zeroed_in(capacity, AbortAlloc(Global))
129129
}
130130

131131
/// Reconstitutes a `RawVec` from a pointer, and capacity.
@@ -137,7 +137,7 @@ impl<T> RawVec<T> {
137137
/// If the ptr and capacity come from a `RawVec` created with `Global`, then this is guaranteed.
138138
#[inline]
139139
pub unsafe fn from_raw_parts(ptr: *mut T, capacity: usize) -> Self {
140-
Self::from_raw_parts_in(ptr, capacity, PanicAdapter(Global))
140+
Self::from_raw_parts_in(ptr, capacity, AbortAlloc(Global))
141141
}
142142
}
143143

src/string.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//! ```
5353
5454
use crate::{
55-
alloc::{AllocRef, DeallocRef, Global, PanicAdapter, ReallocRef},
55+
alloc::{AllocRef, DeallocRef, Global, AbortAlloc, ReallocRef},
5656
boxed::Box,
5757
collections::CollectionAllocErr,
5858
iter::TryExtend,
@@ -312,7 +312,7 @@ pub use liballoc::string::{ParseError, ToString};
312312
/// [`Deref`]: ../../std/ops/trait.Deref.html
313313
/// [`as_str()`]: struct.String.html#method.as_str
314314
#[derive(PartialOrd, Eq, Ord)]
315-
pub struct String<A: DeallocRef = PanicAdapter<Global>> {
315+
pub struct String<A: DeallocRef = AbortAlloc<Global>> {
316316
vec: Vec<u8, A>,
317317
}
318318

@@ -354,7 +354,7 @@ pub struct String<A: DeallocRef = PanicAdapter<Global>> {
354354
/// assert_eq!(vec![0, 159], value.unwrap_err().into_bytes());
355355
/// ```
356356
#[derive(Debug)]
357-
pub struct FromUtf8Error<A: DeallocRef = PanicAdapter<Global>> {
357+
pub struct FromUtf8Error<A: DeallocRef = AbortAlloc<Global>> {
358358
bytes: Vec<u8, A>,
359359
error: Utf8Error,
360360
}
@@ -451,7 +451,7 @@ impl String {
451451
#[inline]
452452
#[must_use]
453453
pub fn with_capacity(capacity: usize) -> Self {
454-
Self::with_capacity_in(capacity, PanicAdapter(Global))
454+
Self::with_capacity_in(capacity, AbortAlloc(Global))
455455
}
456456

457457
/// Decode a UTF-16 encoded vector `v` into a `String`, returning [`Err`]
@@ -475,7 +475,7 @@ impl String {
475475
/// assert!(String::from_utf16(v).is_err());
476476
/// ```
477477
pub fn from_utf16(v: &[u16]) -> Result<Self, FromUtf16Error> {
478-
Self::from_utf16_in(v, PanicAdapter(Global))
478+
Self::from_utf16_in(v, AbortAlloc(Global))
479479
}
480480

481481
/// Decode a UTF-16 encoded slice `v` into a `String`, replacing
@@ -560,7 +560,7 @@ impl String {
560560
/// ```
561561
#[inline]
562562
pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> Self {
563-
Self::from_raw_parts_in(buf, length, capacity, PanicAdapter(Global))
563+
Self::from_raw_parts_in(buf, length, capacity, AbortAlloc(Global))
564564
}
565565
}
566566

src/vec.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
//! [`vec!`]: ../macro.vec.html
7070
7171
use crate::{
72-
alloc::{AllocRef, BuildAllocRef, DeallocRef, Global, PanicAdapter, ReallocRef},
72+
alloc::{AllocRef, BuildAllocRef, DeallocRef, Global, AbortAlloc, ReallocRef},
7373
boxed::Box,
7474
clone::CloneIn,
7575
collections::CollectionAllocErr,
@@ -328,7 +328,7 @@ use core::{
328328
/// [`insert`]: Self::insert()
329329
/// [`reserve`]: Self::reserve
330330
/// [owned slice]: crate::boxed::Box
331-
pub struct Vec<T, A: DeallocRef = PanicAdapter<Global>> {
331+
pub struct Vec<T, A: DeallocRef = AbortAlloc<Global>> {
332332
buf: RawVec<T, A>,
333333
len: usize,
334334
}
@@ -401,7 +401,7 @@ impl<T> Vec<T> {
401401
#[inline]
402402
#[must_use]
403403
pub fn with_capacity(capacity: usize) -> Self {
404-
Self::with_capacity_in(capacity, PanicAdapter(Global))
404+
Self::with_capacity_in(capacity, AbortAlloc(Global))
405405
}
406406

407407
/// Creates a `Vec<T>` directly from the raw components of another vector.
@@ -664,7 +664,7 @@ impl<T, A: DeallocRef> Vec<T, A> {
664664
/// # Examples
665665
///
666666
/// ```
667-
/// use alloc_wg::{alloc::PanicAdapter<Global>, collections::CollectionAllocErr, vec::Vec};
667+
/// use alloc_wg::{alloc::AbortAlloc<Global>, collections::CollectionAllocErr, vec::Vec};
668668
///
669669
/// fn process_data(data: &[u32]) -> Result<Vec<u32>, CollectionAllocErr<Global>> {
670670
/// let mut output = Vec::new();
@@ -2037,7 +2037,7 @@ impl<T: PartialEq, A: DeallocRef> Vec<T, A> {
20372037

20382038
#[doc(hidden)]
20392039
pub fn from_elem<T: Clone>(elem: T, n: usize) -> Vec<T> {
2040-
from_elem_in(elem, n, PanicAdapter(Global))
2040+
from_elem_in(elem, n, AbortAlloc(Global))
20412041
}
20422042

20432043
#[doc(hidden)]
@@ -2280,9 +2280,9 @@ impl<T> FromIterator<T> for Vec<T> {
22802280
#[inline]
22812281
#[must_use]
22822282
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
2283-
<Self as SpecExtend<T, I::IntoIter, PanicAdapter<Global>>>::from_iter_in(
2283+
<Self as SpecExtend<T, I::IntoIter, AbortAlloc<Global>>>::from_iter_in(
22842284
iter.into_iter(),
2285-
PanicAdapter(Global),
2285+
AbortAlloc(Global),
22862286
)
22872287
}
22882288
}
@@ -2923,7 +2923,7 @@ impl From<&str> for Vec<u8> {
29232923
///
29242924
/// [`Vec`]: struct.Vec.html
29252925
/// [`IntoIterator`]: ../../std/iter/trait.IntoIterator.html
2926-
pub struct IntoIter<T, A: DeallocRef = PanicAdapter<Global>> {
2926+
pub struct IntoIter<T, A: DeallocRef = AbortAlloc<Global>> {
29272927
buf: RawVec<T, A>,
29282928
ptr: *const T,
29292929
end: *const T,
@@ -3069,7 +3069,7 @@ impl<T, A: DeallocRef> Drop for IntoIter<T, A> {
30693069
///
30703070
/// [`drain`]: struct.Vec.html#method.drain
30713071
/// [`Vec`]: struct.Vec.html
3072-
pub struct Drain<'a, T, A: DeallocRef = PanicAdapter<Global>> {
3072+
pub struct Drain<'a, T, A: DeallocRef = AbortAlloc<Global>> {
30733073
/// Index of tail to preserve
30743074
tail_start: usize,
30753075
/// Length of tail
@@ -3162,7 +3162,7 @@ impl<T, A: DeallocRef> FusedIterator for Drain<'_, T, A> {}
31623162
/// [`splice()`]: struct.Vec.html#method.splice
31633163
/// [`Vec`]: struct.Vec.html
31643164
#[derive(Debug)]
3165-
pub struct Splice<'a, I: Iterator + 'a, A = PanicAdapter<Global>>
3165+
pub struct Splice<'a, I: Iterator + 'a, A = AbortAlloc<Global>>
31663166
where
31673167
A: ReallocRef<Error = !>, // Because Drop can allocate
31683168
{
@@ -3284,7 +3284,7 @@ where
32843284

32853285
/// An iterator produced by calling `drain_filter` on Vec.
32863286
// #[derive(Debug)]
3287-
pub struct DrainFilter<'a, T, F, A: DeallocRef = PanicAdapter<Global>>
3287+
pub struct DrainFilter<'a, T, F, A: DeallocRef = AbortAlloc<Global>>
32883288
where
32893289
F: FnMut(&mut T) -> bool,
32903290
{
@@ -3347,7 +3347,7 @@ where
33473347
F: FnMut(&mut T) -> bool,
33483348
{
33493349
fn drop(&mut self) {
3350-
struct BackshiftOnDrop<'a, 'b, T, F, A: DeallocRef = PanicAdapter<Global>>
3350+
struct BackshiftOnDrop<'a, 'b, T, F, A: DeallocRef = AbortAlloc<Global>>
33513351
where
33523352
F: FnMut(&mut T) -> bool,
33533353
{

0 commit comments

Comments
 (0)