Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 8d7c25f

Browse files
committed
rustc 1.39.0-nightly (bdfd698f3 2019-08-16) compatibility
rust-lang/rust#61780 changed CollectionAllocErr to TryReserveError.
1 parent e0b22ea commit 8d7c25f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

liblumen_core/src/alloc/raw_vec.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use core::slice;
99
use core::alloc::{Alloc, Layout};
1010

1111
use core_alloc::alloc::handle_alloc_error;
12-
use core_alloc::collections::CollectionAllocErr::{self, *};
12+
use core_alloc::collections::TryReserveError::{self, *};
1313

1414
use crate::alloc::alloc_ref::{AllocRef, AsAllocRef};
1515
use crate::alloc::boxed::Box;
@@ -371,7 +371,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
371371
&mut self,
372372
used_cap: usize,
373373
needed_extra_cap: usize,
374-
) -> Result<(), CollectionAllocErr> {
374+
) -> Result<(), TryReserveError> {
375375
self.reserve_internal(used_cap, needed_extra_cap, Fallible, Exact)
376376
}
377377

@@ -397,7 +397,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
397397
pub fn reserve_exact(&mut self, used_cap: usize, needed_extra_cap: usize) {
398398
match self.reserve_internal(used_cap, needed_extra_cap, Infallible, Exact) {
399399
Err(CapacityOverflow) => capacity_overflow(),
400-
Err(AllocErr) => unreachable!(),
400+
Err(_) => unreachable!(),
401401
Ok(()) => { /* yay */ }
402402
}
403403
}
@@ -409,7 +409,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
409409
&self,
410410
used_cap: usize,
411411
needed_extra_cap: usize,
412-
) -> Result<usize, CollectionAllocErr> {
412+
) -> Result<usize, TryReserveError> {
413413
// Nothing we can really do about these checks :(
414414
let required_cap = used_cap
415415
.checked_add(needed_extra_cap)
@@ -425,7 +425,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
425425
&mut self,
426426
used_cap: usize,
427427
needed_extra_cap: usize,
428-
) -> Result<(), CollectionAllocErr> {
428+
) -> Result<(), TryReserveError> {
429429
self.reserve_internal(used_cap, needed_extra_cap, Fallible, Amortized)
430430
}
431431

@@ -452,7 +452,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
452452
pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
453453
match self.reserve_internal(used_cap, needed_extra_cap, Infallible, Amortized) {
454454
Err(CapacityOverflow) => capacity_overflow(),
455-
Err(AllocErr) => unreachable!(),
455+
Err(_) => unreachable!(),
456456
Ok(()) => { /* yay */ }
457457
}
458458
}
@@ -599,7 +599,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
599599
needed_extra_cap: usize,
600600
fallibility: Fallibility,
601601
strategy: ReserveStrategy,
602-
) -> Result<(), CollectionAllocErr> {
602+
) -> Result<(), TryReserveError> {
603603
unsafe {
604604
use core::alloc::AllocErr;
605605

@@ -639,7 +639,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
639639
_ => {}
640640
}
641641

642-
self.ptr = res?.cast().into();
642+
self.ptr = res.unwrap().cast().into();
643643
self.cap = new_cap;
644644

645645
Ok(())
@@ -676,7 +676,7 @@ unsafe impl<'a, #[may_dangle] T, A: AllocRef<'a>> Drop for RawVec<'a, T, A> {
676676
// all 4GB in user-space. e.g., PAE or x32
677677

678678
#[inline]
679-
fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {
679+
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
680680
if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
681681
Err(CapacityOverflow)
682682
} else {

0 commit comments

Comments
 (0)