1
Fork 0

Return Result instead of Option in alloc::Layout constructors

This commit is contained in:
Simon Sapin 2018-04-04 16:03:46 +02:00
parent f9c96d70bd
commit b017742136
4 changed files with 54 additions and 26 deletions

View file

@ -57,7 +57,7 @@ use cell;
use char;
use core::array;
use fmt::{self, Debug, Display};
use heap::{AllocErr, CannotReallocInPlace};
use heap::{AllocErr, LayoutErr, CannotReallocInPlace};
use mem::transmute;
use num;
use str;
@ -247,6 +247,15 @@ impl Error for AllocErr {
}
}
#[unstable(feature = "allocator_api",
reason = "the precise API and guarantees it provides may be tweaked.",
issue = "32838")]
impl Error for LayoutErr {
fn description(&self) -> &str {
"invalid parameters to Layout::from_size_align"
}
}
#[unstable(feature = "allocator_api",
reason = "the precise API and guarantees it provides may be tweaked.",
issue = "32838")]