fune/toolkit/library/rust/shared/build.rs
Alexis Beingessner 9a0f581986 Bug 1671691 - Enable Rust stdlib instrumentation. r=decoder
* Bumps the tsan toolchain to rust-nightly-2020-11-14 that has my patches to make -Zbuild-std work in vendored environments:
  * https://github.com/rust-lang/cargo/pull/8834
  * https://github.com/rust-lang/rust/pull/78790

* Passes -Zbuild-std to cargo when MOZ_TSAN is defined (mk_add_options --enable-thread-sanitizer)

* Removes generic Rust supressions and adds much more specific ones
    * One presumed upstream false positive from tsan not understanding the code
    * One actual upstream bug tsan found (yay!)
    * One new real issue uncovered
    * One issue that probably already existed intermittently but I happened to hit

Differential Revision: https://phabricator.services.mozilla.com/D97165
2020-11-16 18:36:41 +00:00

28 lines
1.1 KiB
Rust

/* 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/. */
extern crate rustc_version;
use rustc_version::{version, Version};
fn main() {
let ver = version().unwrap();
let mut bootstrap = false;
let max_oom_hook_version = Version::parse("1.51.0-alpha").unwrap();
if ver >= Version::parse("1.28.0-alpha").unwrap() && ver < max_oom_hook_version {
println!("cargo:rustc-cfg=feature=\"oom_with_hook\"");
bootstrap = true;
} else if std::env::var("MOZ_AUTOMATION").is_ok() {
panic!("Builds on automation must use a version of rust for which we know how to hook OOM: want < {}, have {}",
max_oom_hook_version, ver);
}
// This is a rather awful thing to do, but we're only doing it on
// versions of rustc that are not going to change the unstable APIs
// we use from under us, all being already released or beta.
if bootstrap {
println!("cargo:rustc-env=RUSTC_BOOTSTRAP=1");
}
}