@@ -13,17 +13,17 @@ pub use self::layout::{Layout, LayoutErr};
1313use crate :: fmt;
1414use crate :: ptr:: { self , NonNull } ;
1515
16- /// The `AllocErr ` error indicates an allocation failure
16+ /// The `AllocError ` error indicates an allocation failure
1717/// that may be due to resource exhaustion or to
1818/// something wrong when combining the given input arguments with this
1919/// allocator.
2020#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
2121#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
22- pub struct AllocErr ;
22+ pub struct AllocError ;
2323
2424// (we need this for downstream impl of trait Error)
2525#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
26- impl fmt:: Display for AllocErr {
26+ impl fmt:: Display for AllocError {
2727 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
2828 f. write_str ( "memory allocation failed" )
2929 }
@@ -109,7 +109,7 @@ pub unsafe trait AllocRef {
109109 /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar.
110110 ///
111111 /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
112- fn alloc ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > ;
112+ fn alloc ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocError > ;
113113
114114 /// Behaves like `alloc`, but also ensures that the returned memory is zero-initialized.
115115 ///
@@ -126,7 +126,7 @@ pub unsafe trait AllocRef {
126126 /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar.
127127 ///
128128 /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
129- fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
129+ fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocError > {
130130 let ptr = self . alloc ( layout) ?;
131131 // SAFETY: `alloc` returns a valid memory block
132132 unsafe { ptr. as_non_null_ptr ( ) . as_ptr ( ) . write_bytes ( 0 , ptr. len ( ) ) }
@@ -187,7 +187,7 @@ pub unsafe trait AllocRef {
187187 ptr : NonNull < u8 > ,
188188 old_layout : Layout ,
189189 new_layout : Layout ,
190- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
190+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
191191 debug_assert ! (
192192 new_layout. size( ) >= old_layout. size( ) ,
193193 "`new_layout.size()` must be greater than or equal to `old_layout.size()`"
@@ -248,7 +248,7 @@ pub unsafe trait AllocRef {
248248 ptr : NonNull < u8 > ,
249249 old_layout : Layout ,
250250 new_layout : Layout ,
251- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
251+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
252252 debug_assert ! (
253253 new_layout. size( ) >= old_layout. size( ) ,
254254 "`new_layout.size()` must be greater than or equal to `old_layout.size()`"
@@ -312,7 +312,7 @@ pub unsafe trait AllocRef {
312312 ptr : NonNull < u8 > ,
313313 old_layout : Layout ,
314314 new_layout : Layout ,
315- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
315+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
316316 debug_assert ! (
317317 new_layout. size( ) <= old_layout. size( ) ,
318318 "`new_layout.size()` must be smaller than or equal to `old_layout.size()`"
@@ -348,12 +348,12 @@ where
348348 A : AllocRef + ?Sized ,
349349{
350350 #[ inline]
351- fn alloc ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
351+ fn alloc ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocError > {
352352 ( * * self ) . alloc ( layout)
353353 }
354354
355355 #[ inline]
356- fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
356+ fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocError > {
357357 ( * * self ) . alloc_zeroed ( layout)
358358 }
359359
@@ -369,7 +369,7 @@ where
369369 ptr : NonNull < u8 > ,
370370 old_layout : Layout ,
371371 new_layout : Layout ,
372- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
372+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
373373 // SAFETY: the safety contract must be upheld by the caller
374374 unsafe { ( * * self ) . grow ( ptr, old_layout, new_layout) }
375375 }
@@ -380,7 +380,7 @@ where
380380 ptr : NonNull < u8 > ,
381381 old_layout : Layout ,
382382 new_layout : Layout ,
383- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
383+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
384384 // SAFETY: the safety contract must be upheld by the caller
385385 unsafe { ( * * self ) . grow_zeroed ( ptr, old_layout, new_layout) }
386386 }
@@ -391,7 +391,7 @@ where
391391 ptr : NonNull < u8 > ,
392392 old_layout : Layout ,
393393 new_layout : Layout ,
394- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
394+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
395395 // SAFETY: the safety contract must be upheld by the caller
396396 unsafe { ( * * self ) . shrink ( ptr, old_layout, new_layout) }
397397 }
0 commit comments