@@ -9,7 +9,7 @@ use core::slice;
9
9
use core:: alloc:: { Alloc , Layout } ;
10
10
11
11
use core_alloc:: alloc:: handle_alloc_error;
12
- use core_alloc:: collections:: CollectionAllocErr :: { self , * } ;
12
+ use core_alloc:: collections:: TryReserveError :: { self , * } ;
13
13
14
14
use crate :: alloc:: alloc_ref:: { AllocRef , AsAllocRef } ;
15
15
use crate :: alloc:: boxed:: Box ;
@@ -371,7 +371,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
371
371
& mut self ,
372
372
used_cap : usize ,
373
373
needed_extra_cap : usize ,
374
- ) -> Result < ( ) , CollectionAllocErr > {
374
+ ) -> Result < ( ) , TryReserveError > {
375
375
self . reserve_internal ( used_cap, needed_extra_cap, Fallible , Exact )
376
376
}
377
377
@@ -397,7 +397,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
397
397
pub fn reserve_exact ( & mut self , used_cap : usize , needed_extra_cap : usize ) {
398
398
match self . reserve_internal ( used_cap, needed_extra_cap, Infallible , Exact ) {
399
399
Err ( CapacityOverflow ) => capacity_overflow ( ) ,
400
- Err ( AllocErr ) => unreachable ! ( ) ,
400
+ Err ( _ ) => unreachable ! ( ) ,
401
401
Ok ( ( ) ) => { /* yay */ }
402
402
}
403
403
}
@@ -409,7 +409,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
409
409
& self ,
410
410
used_cap : usize ,
411
411
needed_extra_cap : usize ,
412
- ) -> Result < usize , CollectionAllocErr > {
412
+ ) -> Result < usize , TryReserveError > {
413
413
// Nothing we can really do about these checks :(
414
414
let required_cap = used_cap
415
415
. checked_add ( needed_extra_cap)
@@ -425,7 +425,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
425
425
& mut self ,
426
426
used_cap : usize ,
427
427
needed_extra_cap : usize ,
428
- ) -> Result < ( ) , CollectionAllocErr > {
428
+ ) -> Result < ( ) , TryReserveError > {
429
429
self . reserve_internal ( used_cap, needed_extra_cap, Fallible , Amortized )
430
430
}
431
431
@@ -452,7 +452,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
452
452
pub fn reserve ( & mut self , used_cap : usize , needed_extra_cap : usize ) {
453
453
match self . reserve_internal ( used_cap, needed_extra_cap, Infallible , Amortized ) {
454
454
Err ( CapacityOverflow ) => capacity_overflow ( ) ,
455
- Err ( AllocErr ) => unreachable ! ( ) ,
455
+ Err ( _ ) => unreachable ! ( ) ,
456
456
Ok ( ( ) ) => { /* yay */ }
457
457
}
458
458
}
@@ -599,7 +599,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
599
599
needed_extra_cap : usize ,
600
600
fallibility : Fallibility ,
601
601
strategy : ReserveStrategy ,
602
- ) -> Result < ( ) , CollectionAllocErr > {
602
+ ) -> Result < ( ) , TryReserveError > {
603
603
unsafe {
604
604
use core:: alloc:: AllocErr ;
605
605
@@ -639,7 +639,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
639
639
_ => { }
640
640
}
641
641
642
- self . ptr = res? . cast ( ) . into ( ) ;
642
+ self . ptr = res. unwrap ( ) . cast ( ) . into ( ) ;
643
643
self . cap = new_cap;
644
644
645
645
Ok ( ( ) )
@@ -676,7 +676,7 @@ unsafe impl<'a, #[may_dangle] T, A: AllocRef<'a>> Drop for RawVec<'a, T, A> {
676
676
// all 4GB in user-space. e.g., PAE or x32
677
677
678
678
#[ inline]
679
- fn alloc_guard ( alloc_size : usize ) -> Result < ( ) , CollectionAllocErr > {
679
+ fn alloc_guard ( alloc_size : usize ) -> Result < ( ) , TryReserveError > {
680
680
if mem:: size_of :: < usize > ( ) < 8 && alloc_size > core:: isize:: MAX as usize {
681
681
Err ( CapacityOverflow )
682
682
} else {
0 commit comments