bug 1358151: temporary workaround for rust race condition r=ted

MozReview-Commit-ID: KiPArBKMSu1

--HG--
extra : rebase_source : 7e0714b0bb04f019fc26dae80cf1226d298551c3
This commit is contained in:
Carl Corcoran 2017-05-06 14:05:09 +02:00
parent 82c29b3dff
commit 72c896fa45
2 changed files with 19 additions and 0 deletions

View File

@ -19,6 +19,16 @@ use std::ffi::CStr;
use std::os::raw::c_char;
use std::panic;
// This workaround is fixed in Rust 1.19. For details, see bug 1358151.
thread_local!(static UNUSED_THREAD_LOCAL: () = ());
#[no_mangle]
pub extern "C" fn rust_init_please_remove_this_after_updating_rust_1_19() {
UNUSED_THREAD_LOCAL.with(|_| ());
}
/// Used to implement `nsIDebug2::RustPanic` for testing purposes.
#[no_mangle]
pub extern "C" fn intentional_panic(message: *const c_char) {

View File

@ -224,6 +224,12 @@
extern uint32_t gRestartMode;
extern void InstallSignalHandlers(const char *ProgramName);
// This workaround is fixed in Rust 1.19. For details, see bug 1358151.
// Implementation in toolkit/library/rust/shared/lib.rs
extern "C" {
void rust_init_please_remove_this_after_updating_rust_1_19();
}
#define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini")
#define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches")
@ -3114,6 +3120,9 @@ XREMain::XRE_mainInit(bool* aExitFlag)
return 1;
*aExitFlag = false;
// This workaround is fixed in Rust 1.19. For details, see bug 1358151.
rust_init_please_remove_this_after_updating_rust_1_19();
atexit(UnexpectedExit);
auto expectedShutdown = mozilla::MakeScopeExit([&] {
MozExpectedExit();