79
79
//! [`NonZeroLayout::for_value(&*value)`]: crate::alloc::NonZeroLayout::for_value
80
80
81
81
use crate :: {
82
- alloc:: { AbortAlloc , AllocRef , BuildAllocRef , DeallocRef , Global , NonZeroLayout } ,
82
+ alloc:: { AllocRef , BuildAllocRef , DeallocRef , Global , NonZeroLayout } ,
83
83
clone:: CloneIn ,
84
84
collections:: CollectionAllocErr ,
85
85
raw_vec:: RawVec ,
@@ -105,7 +105,7 @@ use core::{
105
105
/// A pointer type for heap allocation.
106
106
///
107
107
/// See the [module-level documentation](index.html) for more.
108
- pub struct Box < T : ?Sized , A : DeallocRef = AbortAlloc < Global > > {
108
+ pub struct Box < T : ?Sized , A : DeallocRef = Global > {
109
109
ptr : Unique < T > ,
110
110
build_alloc : A :: BuildAlloc ,
111
111
}
@@ -131,7 +131,7 @@ impl<T> Box<T> {
131
131
#[ inline( always) ]
132
132
#[ must_use]
133
133
pub fn new ( x : T ) -> Self {
134
- Self :: new_in ( x, AbortAlloc ( Global ) )
134
+ Self :: new_in ( x, Global )
135
135
}
136
136
137
137
/// Constructs a new box with uninitialized contents.
@@ -156,7 +156,7 @@ impl<T> Box<T> {
156
156
#[ inline( always) ]
157
157
#[ must_use]
158
158
pub fn new_uninit ( ) -> Box < mem:: MaybeUninit < T > > {
159
- Self :: new_uninit_in ( AbortAlloc ( Global ) )
159
+ Self :: new_uninit_in ( Global )
160
160
}
161
161
162
162
/// Constructs a new `Pin<Box<T>>`. If `T` does not implement `Unpin`, then
@@ -177,19 +177,16 @@ impl<T, A: AllocRef> Box<T, A> {
177
177
/// # Example
178
178
///
179
179
/// ```
180
- /// use alloc_wg::{
181
- /// alloc::{AbortAlloc, Global},
182
- /// boxed::Box,
183
- /// };
180
+ /// use alloc_wg::{alloc::Global, boxed::Box};
184
181
///
185
182
/// # #[allow(unused_variables)]
186
- /// let five = Box::new_in(5, AbortAlloc( Global) );
183
+ /// let five = Box::new_in(5, Global);
187
184
/// ```
188
185
#[ allow( clippy:: inline_always) ]
189
186
#[ inline( always) ]
190
187
pub fn new_in ( x : T , a : A ) -> Self
191
188
where
192
- A : AllocRef < Error = ! > ,
189
+ A : AllocRef ,
193
190
{
194
191
unsafe { Self :: try_new_in ( x, a) . unwrap_unchecked ( ) }
195
192
}
@@ -225,12 +222,9 @@ impl<T, A: AllocRef> Box<T, A> {
225
222
/// # Example
226
223
///
227
224
/// ```
228
- /// use alloc_wg::{
229
- /// alloc::{AbortAlloc, Global},
230
- /// boxed::Box,
231
- /// };
225
+ /// use alloc_wg::{alloc::Global, boxed::Box};
232
226
///
233
- /// let mut five = Box::<u32, _>::new_uninit_in(AbortAlloc( Global) );
227
+ /// let mut five = Box::<u32, _>::new_uninit_in(Global);
234
228
///
235
229
/// let five = unsafe {
236
230
/// // Deferred initialization:
@@ -245,7 +239,7 @@ impl<T, A: AllocRef> Box<T, A> {
245
239
#[ inline( always) ]
246
240
pub fn new_uninit_in ( a : A ) -> Box < mem:: MaybeUninit < T > , A >
247
241
where
248
- A : AllocRef < Error = ! > ,
242
+ A : AllocRef ,
249
243
{
250
244
unsafe { Self :: try_new_uninit_in ( a) . unwrap_unchecked ( ) }
251
245
}
@@ -285,7 +279,7 @@ impl<T, A: AllocRef> Box<T, A> {
285
279
#[ inline( always) ]
286
280
pub fn pin_in ( x : T , a : A ) -> Pin < Self >
287
281
where
288
- A : AllocRef < Error = ! > ,
282
+ A : AllocRef ,
289
283
{
290
284
unsafe { Self :: try_pin_in ( x, a) . unwrap_unchecked ( ) }
291
285
}
@@ -324,7 +318,7 @@ impl<T> Box<[T]> {
324
318
#[ inline( always) ]
325
319
#[ must_use]
326
320
pub fn new_uninit_slice ( len : usize ) -> Box < [ mem:: MaybeUninit < T > ] > {
327
- Self :: new_uninit_slice_in ( len, AbortAlloc ( Global ) )
321
+ Self :: new_uninit_slice_in ( len, Global )
328
322
}
329
323
}
330
324
@@ -335,12 +329,9 @@ impl<T, A: AllocRef> Box<[T], A> {
335
329
/// # Example
336
330
///
337
331
/// ```
338
- /// use alloc_wg::{
339
- /// alloc::{AbortAlloc, Global},
340
- /// boxed::Box,
341
- /// };
332
+ /// use alloc_wg::{alloc::Global, boxed::Box};
342
333
///
343
- /// let mut values = Box::<[u32], AbortAlloc<Global>> ::new_uninit_slice_in(3, AbortAlloc( Global) );
334
+ /// let mut values = Box::<[u32], _> ::new_uninit_slice_in(3, Global);
344
335
///
345
336
/// let values = unsafe {
346
337
/// // Deferred initialization:
@@ -357,7 +348,7 @@ impl<T, A: AllocRef> Box<[T], A> {
357
348
#[ inline( always) ]
358
349
pub fn new_uninit_slice_in ( len : usize , a : A ) -> Box < [ mem:: MaybeUninit < T > ] , A >
359
350
where
360
- A : AllocRef < Error = ! > ,
351
+ A : AllocRef ,
361
352
{
362
353
unsafe { Self :: try_new_uninit_slice_in ( len, a) . unwrap_unchecked ( ) }
363
354
}
@@ -524,7 +515,7 @@ impl<T: ?Sized> Box<T> {
524
515
#[ allow( clippy:: inline_always) ]
525
516
#[ inline( always) ]
526
517
pub unsafe fn from_raw ( raw : * mut T ) -> Self {
527
- Self :: from_raw_in ( raw, AbortAlloc ( Global ) )
518
+ Self :: from_raw_in ( raw, Global )
528
519
}
529
520
}
530
521
@@ -768,7 +759,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: DeallocRef> Drop for Box<T, A> {
768
759
impl < T , A > Default for Box < T , A >
769
760
where
770
761
T : Default ,
771
- A : Default + AllocRef < Error = ! > ,
762
+ A : Default + AllocRef ,
772
763
{
773
764
#[ must_use]
774
765
fn default ( ) -> Self {
@@ -779,7 +770,7 @@ where
779
770
#[ allow( clippy:: use_self) ]
780
771
impl < T , A > Default for Box < [ T ] , A >
781
772
where
782
- A : Default + AllocRef < Error = ! > ,
773
+ A : Default + AllocRef ,
783
774
{
784
775
#[ must_use]
785
776
fn default ( ) -> Self {
@@ -796,7 +787,7 @@ unsafe fn from_boxed_utf8_unchecked<A: DeallocRef>(v: Box<[u8], A>) -> Box<str,
796
787
#[ allow( clippy:: use_self) ]
797
788
impl < A > Default for Box < str , A >
798
789
where
799
- A : Default + AllocRef < Error = ! > ,
790
+ A : Default + AllocRef ,
800
791
{
801
792
#[ must_use]
802
793
fn default ( ) -> Self {
@@ -806,7 +797,7 @@ where
806
797
807
798
impl < T : Clone , A : Clone > Clone for Box < T , A >
808
799
where
809
- A : AllocRef < Error = ! > ,
800
+ A : AllocRef ,
810
801
A :: BuildAlloc : Clone ,
811
802
{
812
803
/// Returns a new box with a `clone()` of this box's contents.
@@ -869,7 +860,7 @@ impl<T: Clone, A: AllocRef, B: AllocRef> CloneIn<B> for Box<T, A> {
869
860
870
861
fn clone_in ( & self , a : B ) -> Self :: Cloned
871
862
where
872
- B : AllocRef < Error = ! > ,
863
+ B : AllocRef ,
873
864
{
874
865
Box :: new_in ( self . as_ref ( ) . clone ( ) , a)
875
866
}
@@ -973,7 +964,7 @@ impl<T: ?Sized + Hasher, A: DeallocRef> Hasher for Box<T, A> {
973
964
974
965
impl < T , A > From < T > for Box < T , A >
975
966
where
976
- A : Default + AllocRef < Error = ! > ,
967
+ A : Default + AllocRef ,
977
968
{
978
969
/// Converts a generic type `T` into a `Box<T>`
979
970
///
@@ -1007,7 +998,7 @@ impl<T: ?Sized, A: DeallocRef> From<Box<T, A>> for Pin<Box<T, A>> {
1007
998
#[ allow( clippy:: use_self) ]
1008
999
impl < T : Copy , A > From < & [ T ] > for Box < [ T ] , A >
1009
1000
where
1010
- A : Default + AllocRef < Error = ! > ,
1001
+ A : Default + AllocRef ,
1011
1002
{
1012
1003
/// Converts a `&[T]` into a `Box<[T], B>`
1013
1004
///
@@ -1036,7 +1027,7 @@ where
1036
1027
#[ allow( clippy:: use_self) ]
1037
1028
impl < A > From < & str > for Box < str , A >
1038
1029
where
1039
- A : Default + AllocRef < Error = ! > ,
1030
+ A : Default + AllocRef ,
1040
1031
{
1041
1032
/// Converts a `&str` into a `Box<str>`
1042
1033
///
@@ -1290,16 +1281,13 @@ macro_rules! impl_dispatch_from_dyn {
1290
1281
}
1291
1282
1292
1283
impl_dispatch_from_dyn ! ( Global ) ;
1293
- impl_dispatch_from_dyn ! ( AbortAlloc <Global >) ;
1294
1284
#[ cfg( feature = "std" ) ]
1295
1285
impl_dispatch_from_dyn ! ( std:: alloc:: System ) ;
1296
- #[ cfg( feature = "std" ) ]
1297
- impl_dispatch_from_dyn ! ( AbortAlloc <std:: alloc:: System >) ;
1298
1286
1299
1287
#[ allow( clippy:: items_after_statements) ]
1300
1288
impl < T : Clone , A : Clone > Clone for Box < [ T ] , A >
1301
1289
where
1302
- A : AllocRef < Error = ! > ,
1290
+ A : AllocRef ,
1303
1291
A :: BuildAlloc : Clone ,
1304
1292
{
1305
1293
fn clone ( & self ) -> Self {
0 commit comments