Return Result instead of Option in alloc::Layout constructors
This commit is contained in:
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user