@@ -13,17 +13,17 @@ pub use self::layout::{Layout, LayoutErr};
13
13
use crate :: fmt;
14
14
use crate :: ptr:: { self , NonNull } ;
15
15
16
- /// The `AllocErr ` error indicates an allocation failure
16
+ /// The `AllocError ` error indicates an allocation failure
17
17
/// that may be due to resource exhaustion or to
18
18
/// something wrong when combining the given input arguments with this
19
19
/// allocator.
20
20
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
21
21
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
22
- pub struct AllocErr ;
22
+ pub struct AllocError ;
23
23
24
24
// (we need this for downstream impl of trait Error)
25
25
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
26
- impl fmt:: Display for AllocErr {
26
+ impl fmt:: Display for AllocError {
27
27
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
28
28
f. write_str ( "memory allocation failed" )
29
29
}
@@ -109,7 +109,7 @@ pub unsafe trait AllocRef {
109
109
/// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar.
110
110
///
111
111
/// [`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 > ;
113
113
114
114
/// Behaves like `alloc`, but also ensures that the returned memory is zero-initialized.
115
115
///
@@ -126,7 +126,7 @@ pub unsafe trait AllocRef {
126
126
/// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar.
127
127
///
128
128
/// [`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 > {
130
130
let ptr = self . alloc ( layout) ?;
131
131
// SAFETY: `alloc` returns a valid memory block
132
132
unsafe { ptr. as_non_null_ptr ( ) . as_ptr ( ) . write_bytes ( 0 , ptr. len ( ) ) }
@@ -187,7 +187,7 @@ pub unsafe trait AllocRef {
187
187
ptr : NonNull < u8 > ,
188
188
old_layout : Layout ,
189
189
new_layout : Layout ,
190
- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
190
+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
191
191
debug_assert ! (
192
192
new_layout. size( ) >= old_layout. size( ) ,
193
193
"`new_layout.size()` must be greater than or equal to `old_layout.size()`"
@@ -248,7 +248,7 @@ pub unsafe trait AllocRef {
248
248
ptr : NonNull < u8 > ,
249
249
old_layout : Layout ,
250
250
new_layout : Layout ,
251
- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
251
+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
252
252
debug_assert ! (
253
253
new_layout. size( ) >= old_layout. size( ) ,
254
254
"`new_layout.size()` must be greater than or equal to `old_layout.size()`"
@@ -312,7 +312,7 @@ pub unsafe trait AllocRef {
312
312
ptr : NonNull < u8 > ,
313
313
old_layout : Layout ,
314
314
new_layout : Layout ,
315
- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
315
+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
316
316
debug_assert ! (
317
317
new_layout. size( ) <= old_layout. size( ) ,
318
318
"`new_layout.size()` must be smaller than or equal to `old_layout.size()`"
@@ -348,12 +348,12 @@ where
348
348
A : AllocRef + ?Sized ,
349
349
{
350
350
#[ inline]
351
- fn alloc ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
351
+ fn alloc ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocError > {
352
352
( * * self ) . alloc ( layout)
353
353
}
354
354
355
355
#[ inline]
356
- fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
356
+ fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocError > {
357
357
( * * self ) . alloc_zeroed ( layout)
358
358
}
359
359
@@ -369,7 +369,7 @@ where
369
369
ptr : NonNull < u8 > ,
370
370
old_layout : Layout ,
371
371
new_layout : Layout ,
372
- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
372
+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
373
373
// SAFETY: the safety contract must be upheld by the caller
374
374
unsafe { ( * * self ) . grow ( ptr, old_layout, new_layout) }
375
375
}
@@ -380,7 +380,7 @@ where
380
380
ptr : NonNull < u8 > ,
381
381
old_layout : Layout ,
382
382
new_layout : Layout ,
383
- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
383
+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
384
384
// SAFETY: the safety contract must be upheld by the caller
385
385
unsafe { ( * * self ) . grow_zeroed ( ptr, old_layout, new_layout) }
386
386
}
@@ -391,7 +391,7 @@ where
391
391
ptr : NonNull < u8 > ,
392
392
old_layout : Layout ,
393
393
new_layout : Layout ,
394
- ) -> Result < NonNull < [ u8 ] > , AllocErr > {
394
+ ) -> Result < NonNull < [ u8 ] > , AllocError > {
395
395
// SAFETY: the safety contract must be upheld by the caller
396
396
unsafe { ( * * self ) . shrink ( ptr, old_layout, new_layout) }
397
397
}
0 commit comments