Return Result instead of Option in alloc::Layout constructors
This commit is contained in:
parent
f9c96d70bd
commit
b017742136
4 changed files with 54 additions and 26 deletions
|
@ -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")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue