@@ -88,7 +88,7 @@ use core::ptr::{self, NonNull, Unique};
8888use core:: task:: { Context , Poll } ;
8989
9090use crate :: alloc:: {
91- Stage0Alloc as Alloc , Global , Layout , handle_alloc_error, stage0_phantom, stage0_unphantom
91+ Stage0Alloc as Alloc , AllocHelper , AllocErr , Global , Layout , handle_alloc_error, stage0_phantom, stage0_unphantom
9292} ;
9393use crate :: vec:: Vec ;
9494use crate :: raw_vec:: RawVec ;
@@ -137,7 +137,7 @@ impl<T> Box<T> {
137137 }
138138}
139139
140- impl < T , A : Alloc > Box < T , A > {
140+ impl < T , A : Alloc < Err = AllocErr > > Box < T , A > {
141141 /// Allocates memory in the given allocator and then places `x` into it.
142142 ///
143143 /// This doesn't actually allocate if `T` is zero-sized.
@@ -210,7 +210,7 @@ impl<T: ?Sized> Box<T> {
210210 }
211211}
212212
213- impl < T : ?Sized , A : Alloc > Box < T , A > {
213+ impl < T : ?Sized , A > Box < T , A > {
214214 /// Constructs a box from a raw pointer in the given allocator.
215215 ///
216216 /// This is similar to the [`Box::from_raw`] function, but assumes
@@ -394,29 +394,29 @@ unsafe impl<#[may_dangle] T: ?Sized, A> Drop for Box<T, A> {
394394}
395395
396396#[ stable( feature = "rust1" , since = "1.0.0" ) ]
397- impl < T : Default , A : Alloc + Default > Default for Box < T , A > {
397+ impl < T : Default , A : Alloc < Err = AllocErr > + Default > Default for Box < T , A > {
398398 /// Creates a `Box<T, A>`, with the `Default` value for T.
399399 fn default ( ) -> Box < T , A > {
400400 Box :: new_in ( Default :: default ( ) , A :: default ( ) )
401401 }
402402}
403403
404404#[ stable( feature = "rust1" , since = "1.0.0" ) ]
405- impl < T , A : Alloc + Default > Default for Box < [ T ] , A > {
405+ impl < T , A : Alloc < Err = AllocErr > + Default > Default for Box < [ T ] , A > {
406406 fn default ( ) -> Box < [ T ] , A > {
407407 Box :: < [ T ; 0 ] , A > :: new_in ( [ ] , A :: default ( ) )
408408 }
409409}
410410
411411#[ stable( feature = "default_box_extra" , since = "1.17.0" ) ]
412- impl < A : Alloc + Default > Default for Box < str , A > {
412+ impl < A : Alloc < Err = AllocErr > + Default > Default for Box < str , A > {
413413 fn default ( ) -> Box < str , A > {
414414 unsafe { from_boxed_utf8_unchecked ( Default :: default ( ) ) }
415415 }
416416}
417417
418418#[ stable( feature = "rust1" , since = "1.0.0" ) ]
419- impl < T : Clone , A : Alloc + Clone > Clone for Box < T , A > {
419+ impl < T : Clone , A : Alloc < Err = AllocErr > + Clone > Clone for Box < T , A > {
420420 /// Returns a new box with a `clone()` of this box's contents.
421421 ///
422422 /// # Examples
@@ -448,9 +448,8 @@ impl<T: Clone, A: Alloc + Clone> Clone for Box<T, A> {
448448 }
449449}
450450
451-
452451#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
453- impl < A : Alloc + Clone > Clone for Box < str , A > {
452+ impl < A : Alloc < Err = AllocErr > + Clone > Clone for Box < str , A > {
454453 fn clone ( & self ) -> Self {
455454 let len = self . len ( ) ;
456455 let buf = RawVec :: with_capacity_in ( len, stage0_unphantom ( self . 1 . clone ( ) ) ) ;
@@ -559,7 +558,7 @@ impl<T: ?Sized + Hasher, A> Hasher for Box<T, A> {
559558}
560559
561560#[ stable( feature = "from_for_ptrs" , since = "1.6.0" ) ]
562- impl < T , A : Alloc + Default > From < T > for Box < T , A > {
561+ impl < T , A : Alloc < Err = AllocErr > + Default > From < T > for Box < T , A > {
563562 /// Converts a generic type `T` into a `Box<T>`
564563 ///
565564 /// The conversion allocates on the heap and moves `t`
@@ -588,7 +587,7 @@ impl<T: ?Sized, A> From<Box<T, A>> for Pin<Box<T, A>> {
588587}
589588
590589#[ stable( feature = "box_from_slice" , since = "1.17.0" ) ]
591- impl < T : Copy , A : Alloc + Default > From < & [ T ] > for Box < [ T ] , A > {
590+ impl < T : Copy , A : Alloc < Err = AllocErr > + Default > From < & [ T ] > for Box < [ T ] , A > {
592591 /// Converts a `&[T]` into a `Box<[T]>`
593592 ///
594593 /// This conversion allocates on the heap
@@ -611,7 +610,7 @@ impl<T: Copy, A: Alloc + Default> From<&[T]> for Box<[T], A> {
611610}
612611
613612#[ stable( feature = "box_from_slice" , since = "1.17.0" ) ]
614- impl < A : Alloc + Default > From < & str > for Box < str , A > {
613+ impl < A : Alloc < Err = AllocErr > + Default > From < & str > for Box < str , A > {
615614 /// Converts a `&str` into a `Box<str>`
616615 ///
617616 /// This conversion allocates on the heap
@@ -629,7 +628,7 @@ impl<A: Alloc + Default> From<&str> for Box<str, A> {
629628}
630629
631630#[ stable( feature = "boxed_str_conv" , since = "1.19.0" ) ]
632- impl < A : Alloc > From < Box < str , A > > for Box < [ u8 ] , A > {
631+ impl < A > From < Box < str , A > > for Box < [ u8 ] , A > {
633632 /// Converts a `Box<str>>` into a `Box<[u8]>`
634633 ///
635634 /// This conversion does not allocate on the heap and happens in place.
@@ -652,7 +651,7 @@ impl<A: Alloc> From<Box<str, A>> for Box<[u8], A> {
652651 }
653652}
654653
655- impl < A : Alloc > Box < dyn Any , A > {
654+ impl < A > Box < dyn Any , A > {
656655 #[ inline]
657656 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
658657 /// Attempt to downcast the box to a concrete type.
@@ -683,7 +682,7 @@ impl<A: Alloc> Box<dyn Any, A> {
683682 }
684683}
685684
686- impl < A : Alloc > Box < dyn Any + Send , A > {
685+ impl < A : Alloc < Err = AllocErr > > Box < dyn Any + Send , A > {
687686 #[ inline]
688687 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
689688 /// Attempt to downcast the box to a concrete type.
@@ -885,7 +884,7 @@ impl<A> FromIterator<A> for Box<[A]> {
885884}
886885
887886#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
888- impl < T : Clone , A : Alloc + Clone > Clone for Box < [ T ] , A > {
887+ impl < T : Clone , A : Alloc < Err = AllocErr > + Clone > Clone for Box < [ T ] , A > {
889888 fn clone ( & self ) -> Self {
890889 let mut new = BoxBuilder {
891890 data : RawVec :: with_capacity_in ( self . len ( ) , stage0_unphantom ( self . 1 . clone ( ) ) ) ,
@@ -906,20 +905,20 @@ impl<T: Clone, A: Alloc + Clone> Clone for Box<[T], A> {
906905 return unsafe { new. into_box ( ) } ;
907906
908907 // Helper type for responding to panics correctly.
909- struct BoxBuilder < T , A : Alloc > {
908+ struct BoxBuilder < T , A : Alloc < Err = AllocErr > + AllocHelper < Err = AllocErr > > {
910909 data : RawVec < T , A > ,
911910 len : usize ,
912911 }
913912
914- impl < T , A : Alloc > BoxBuilder < T , A > {
913+ impl < T , A : Alloc < Err = AllocErr > > BoxBuilder < T , A > {
915914 unsafe fn into_box ( self ) -> Box < [ T ] , A > {
916915 let raw = ptr:: read ( & self . data ) ;
917916 mem:: forget ( self ) ;
918917 raw. into_box ( )
919918 }
920919 }
921920
922- impl < T , A : Alloc > Drop for BoxBuilder < T , A > {
921+ impl < T , A : Alloc < Err = AllocErr > > Drop for BoxBuilder < T , A > {
923922 fn drop ( & mut self ) {
924923 let mut data = self . data . ptr ( ) ;
925924 let max = unsafe { data. add ( self . len ) } ;
0 commit comments