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

Commit

Permalink
rustc 1.39.0-nightly (bdfd698f3 2019-08-16) compatibility
Browse files Browse the repository at this point in the history
rust-lang/rust#61780 changed CollectionAllocErr
to TryReserveError.
  • Loading branch information
KronicDeth committed Aug 17, 2019
1 parent e0b22ea commit 8d7c25f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions liblumen_core/src/alloc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::slice;
use core::alloc::{Alloc, Layout};

use core_alloc::alloc::handle_alloc_error;
use core_alloc::collections::CollectionAllocErr::{self, *};
use core_alloc::collections::TryReserveError::{self, *};

use crate::alloc::alloc_ref::{AllocRef, AsAllocRef};
use crate::alloc::boxed::Box;
Expand Down Expand Up @@ -371,7 +371,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
&mut self,
used_cap: usize,
needed_extra_cap: usize,
) -> Result<(), CollectionAllocErr> {
) -> Result<(), TryReserveError> {
self.reserve_internal(used_cap, needed_extra_cap, Fallible, Exact)
}

Expand All @@ -397,7 +397,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
pub fn reserve_exact(&mut self, used_cap: usize, needed_extra_cap: usize) {
match self.reserve_internal(used_cap, needed_extra_cap, Infallible, Exact) {
Err(CapacityOverflow) => capacity_overflow(),
Err(AllocErr) => unreachable!(),
Err(_) => unreachable!(),
Ok(()) => { /* yay */ }
}
}
Expand All @@ -409,7 +409,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
&self,
used_cap: usize,
needed_extra_cap: usize,
) -> Result<usize, CollectionAllocErr> {
) -> Result<usize, TryReserveError> {
// Nothing we can really do about these checks :(
let required_cap = used_cap
.checked_add(needed_extra_cap)
Expand All @@ -425,7 +425,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
&mut self,
used_cap: usize,
needed_extra_cap: usize,
) -> Result<(), CollectionAllocErr> {
) -> Result<(), TryReserveError> {
self.reserve_internal(used_cap, needed_extra_cap, Fallible, Amortized)
}

Expand All @@ -452,7 +452,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
match self.reserve_internal(used_cap, needed_extra_cap, Infallible, Amortized) {
Err(CapacityOverflow) => capacity_overflow(),
Err(AllocErr) => unreachable!(),
Err(_) => unreachable!(),
Ok(()) => { /* yay */ }
}
}
Expand Down Expand Up @@ -599,7 +599,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
needed_extra_cap: usize,
fallibility: Fallibility,
strategy: ReserveStrategy,
) -> Result<(), CollectionAllocErr> {
) -> Result<(), TryReserveError> {
unsafe {
use core::alloc::AllocErr;

Expand Down Expand Up @@ -639,7 +639,7 @@ impl<'a, T, A: AllocRef<'a>> RawVec<'a, T, A> {
_ => {}
}

self.ptr = res?.cast().into();
self.ptr = res.unwrap().cast().into();
self.cap = new_cap;

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

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

0 comments on commit 8d7c25f

Please sign in to comment.