Bug 1469766 - Update OOM hook on rustc 1.28 after rust PR 51543. r?froydnj
--- a/taskcluster/ci/toolchain/linux.yml
+++ b/taskcluster/ci/toolchain/linux.yml
@@ -426,17 +426,17 @@ linux64-rust-nightly:
worker:
max-run-time: 7200
env:
UPLOAD_DIR: artifacts
run:
using: toolchain-script
script: repack_rust.py
arguments: [
- '--channel', 'nightly-2018-06-13',
+ '--channel', 'nightly-2018-06-20',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
]
toolchain-artifact: public/build/rustc.tar.xz
linux64-rust-macos-1.24:
description: "rust repack with macos-cross support"
--- a/toolkit/library/rust/shared/lib.rs
+++ b/toolkit/library/rust/shared/lib.rs
@@ -1,15 +1,15 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#![cfg_attr(feature = "oom_with_global_alloc",
feature(global_allocator, alloc, alloc_system, allocator_api))]
-#![cfg_attr(feature = "oom_with_hook", feature(oom_hook))]
+#![cfg_attr(feature = "oom_with_hook", feature(alloc_error_hook))]
#[cfg(feature="servo")]
extern crate geckoservo;
extern crate mp4parse_capi;
extern crate nsstring;
extern crate nserror;
extern crate xpcom;
@@ -217,30 +217,30 @@ mod global_alloc {
}
#[cfg(feature = "oom_with_global_alloc")]
#[global_allocator]
static HEAP: global_alloc::GeckoHeap = global_alloc::GeckoHeap;
#[cfg(feature = "oom_with_hook")]
mod oom_hook {
- use std::alloc::{Layout, set_oom_hook};
+ use std::alloc::{Layout, set_alloc_error_hook};
extern "C" {
fn GeckoHandleOOM(size: usize) -> !;
}
pub fn hook(layout: Layout) {
unsafe {
GeckoHandleOOM(layout.size());
}
}
pub fn install() {
- set_oom_hook(hook);
+ set_alloc_error_hook(hook);
}
}
#[no_mangle]
pub extern "C" fn install_rust_oom_hook() {
#[cfg(feature = "oom_with_hook")]
oom_hook::install();
}