about summary refs log tree commit diff
path: root/src/libstd/alloc.rs
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2018-05-15 09:56:46 +0900
committerMike Hommey <mh@glandium.org>2018-05-30 05:35:48 +0900
commit0f4ef003ac1691d04f0ce519d1d78696689534aa (patch)
tree389cc750501eda02bc699d4ac967f0000a546fa1 /src/libstd/alloc.rs
parent5015fa346c1bf7e295fc16996ed0d3309c84f09a (diff)
downloadrust-0f4ef003ac1691d04f0ce519d1d78696689534aa.tar.gz
rust-0f4ef003ac1691d04f0ce519d1d78696689534aa.zip
Pass a `Layout` to `oom`
As discussed in
https://github.com/rust-lang/rust/issues/49668#issuecomment-384893456
and subsequent, there are use-cases where the OOM handler needs to know
the size of the allocation that failed. The alignment might also be a
cause for allocation failure, so providing it as well can be useful.
Diffstat (limited to 'src/libstd/alloc.rs')
-rw-r--r--src/libstd/alloc.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs
index 78d3d6d5e60..0c95ceff2e3 100644
--- a/src/libstd/alloc.rs
+++ b/src/libstd/alloc.rs
@@ -13,14 +13,14 @@
 #![unstable(issue = "32838", feature = "allocator_api")]
 
 #[doc(inline)] #[allow(deprecated)] pub use alloc_crate::alloc::Heap;
-#[doc(inline)] pub use alloc_crate::alloc::{Global, oom};
+#[doc(inline)] pub use alloc_crate::alloc::{Global, Layout, oom};
 #[doc(inline)] pub use alloc_system::System;
 #[doc(inline)] pub use core::alloc::*;
 
 #[cfg(not(test))]
 #[doc(hidden)]
 #[lang = "oom"]
-pub extern fn rust_oom() -> ! {
+pub extern fn rust_oom(_: Layout) -> ! {
     rtabort!("memory allocation failed");
 }