about summary refs log tree commit diff
path: root/src/liballoc/lib.rs
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-10-28 17:06:06 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-11-01 19:23:20 -0400
commitfea985a0b5008bc2f441866a80c0e3a16592eaab (patch)
treee612e8ff8f24654005783cf9628f7c37fbfcd59c /src/liballoc/lib.rs
parent39f90aead4ad52de1d2c50418da4d66320233d8e (diff)
downloadrust-fea985a0b5008bc2f441866a80c0e3a16592eaab.tar.gz
rust-fea985a0b5008bc2f441866a80c0e3a16592eaab.zip
bubble up out-of-memory errors from liballoc
This makes the low-level allocation API suitable for use cases where
out-of-memory conditions need to be handled.

Closes #18292

[breaking-change]
Diffstat (limited to 'src/liballoc/lib.rs')
-rw-r--r--src/liballoc/lib.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index c721649ca9d..2ff151c1363 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -11,8 +11,7 @@
 //! # The Rust core allocation library
 //!
 //! This is the lowest level library through which allocation in Rust can be
-//! performed where the allocation is assumed to succeed. This library will
-//! abort the process when allocation fails.
+//! performed.
 //!
 //! This library, like libcore, is not intended for general usage, but rather as
 //! a building block of other libraries. The types and interfaces in this
@@ -95,8 +94,10 @@ pub mod boxed;
 pub mod arc;
 pub mod rc;
 
-/// Common OOM routine used by liballoc
-fn oom() -> ! {
+/// Common out-of-memory routine
+#[cold]
+#[inline(never)]
+pub fn oom() -> ! {
     // FIXME(#14674): This really needs to do something other than just abort
     //                here, but any printing done must be *guaranteed* to not
     //                allocate.