diff options
| author | Steven Fackler <sfackler@gmail.com> | 2018-04-20 21:05:13 -0700 | 
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2018-04-22 10:08:17 -0700 | 
| commit | e513c1bd314bbeb6295a7a759de8833b52ff854d (patch) | |
| tree | 538d71f49b7258fb3e55fdd6245dacd829f4dcf7 /src/libstd/alloc.rs | |
| parent | 88873965137e752407d5797e7319410df2554f0c (diff) | |
| download | rust-e513c1bd314bbeb6295a7a759de8833b52ff854d.tar.gz rust-e513c1bd314bbeb6295a7a759de8833b52ff854d.zip | |
Replace GlobalAlloc::oom with a lang item
Diffstat (limited to 'src/libstd/alloc.rs')
| -rw-r--r-- | src/libstd/alloc.rs | 13 | 
1 files changed, 11 insertions, 2 deletions
| diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs index ff578ec42d2..a8578404467 100644 --- a/src/libstd/alloc.rs +++ b/src/libstd/alloc.rs @@ -13,10 +13,18 @@ #![unstable(issue = "32838", feature = "allocator_api")] #[doc(inline)] #[allow(deprecated)] pub use alloc_crate::alloc::Heap; -#[doc(inline)] pub use alloc_crate::alloc::Global; +#[doc(inline)] pub use alloc_crate::alloc::{Global, oom}; #[doc(inline)] pub use alloc_system::System; #[doc(inline)] pub use core::alloc::*; +#[cfg(not(stage0))] +#[cfg(not(test))] +#[doc(hidden)] +#[lang = "oom"] +pub extern fn rust_oom() -> ! { + rtabort!("memory allocation failed"); +} + #[cfg(not(test))] #[doc(hidden)] #[allow(unused_attributes)] @@ -35,10 +43,11 @@ pub mod __default_lib_allocator { System.alloc(layout) as *mut u8 } + #[cfg(stage0)] #[no_mangle] #[rustc_std_internal_symbol] pub unsafe extern fn __rdl_oom() -> ! { - System.oom() + super::oom() } #[no_mangle] | 
