Bug 1405105 - remove Rust init hack now that we require 1.19; r=ccorcoran
authorNathan Froyd <froydnj@mozilla.com>
Wed, 04 Oct 2017 09:53:20 -0400
changeset 1311793 77b91f388fee2c961a00c39ae6314934392ec351
parent 1311792 fa3f9e9479ae96c92b9a68ca0e8dda2808d9e260
child 1311794 03487f70562ad79f1248190255fc193be9bbd8fa
push id225897
push useropettay@mozilla.com
push dateWed, 04 Oct 2017 19:25:01 +0000
treeherdertry@2f2f41234c44 [default view] [failures only]
reviewersccorcoran
bugs1405105
milestone58.0a1
Bug 1405105 - remove Rust init hack now that we require 1.19; r=ccorcoran We added this to avoid race conditions, but a fix which removes the need for it has been landed in Rust 1.19+, which we now require.
toolkit/library/rust/shared/lib.rs
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/library/rust/shared/lib.rs
+++ b/toolkit/library/rust/shared/lib.rs
@@ -25,24 +25,16 @@ extern crate syn;
 
 use std::boxed::Box;
 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) {
     panic!("{}", unsafe { CStr::from_ptr(message) }.to_string_lossy());
 }
 
 /// Contains the panic message, if set.
 static mut PANIC_REASON: Option<*const str> = None;
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -226,22 +226,16 @@
 
 #ifdef MOZ_CODE_COVERAGE
 #include "mozilla/CodeCoverageHandler.h"
 #endif
 
 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")
 
 int    gArgc;
 char **gArgv;
 
 static const char gToolkitVersion[] = NS_STRINGIFY(GRE_MILESTONE);
 static const char gToolkitBuildID[] = NS_STRINGIFY(MOZ_BUILDID);
@@ -3195,19 +3189,16 @@ public:
  */
 int
 XREMain::XRE_mainInit(bool* aExitFlag)
 {
   if (!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();
   });
 
   StartupTimeline::Record(StartupTimeline::MAIN);
 
   if (PR_GetEnv("MOZ_CHAOSMODE")) {