fune/toolkit/library/rust/shared/build.rs
Mike Hommey ed54beeab0 Bug 1458161 - Hook rust OOM handler. r=froydnj
OOM rust crashes are currently not identified as such in crash reports
because rust libstd handles the OOMs and panics itself.

There are unstable ways to hook into this, which unfortunately are under
active changes in rust 1.27, but we're currently on 1.24 and 1.27 is not
released yet. The APIs didn't change between 1.24 and 1.26, so it's
fine-ish to use them as long as we limit their use to those versions.

As long as the Firefox versions we ship (as opposed to downstream) use
the "right" version of rust, we're good to go.

The APIs are in their phase of stabilization, so there shouldn't be too
many variants of the code to support.

--HG--
extra : rebase_source : 08a85aa102b24380b1f6764effffcc909ef3191b
2018-05-01 10:30:03 +09:00

8 lines
362 B
Rust

fn main() {
// This is a rather awful thing to do, but we're only doing it on
// versions of rustc, >= 1.24 < 1.27, that are not going to change
// the unstable APIs we use from under us (1.26 being a beta as of
// writing, and close to release).
#[cfg(feature = "oom_with_global_alloc")]
println!("cargo:rustc-env=RUSTC_BOOTSTRAP=1");
}