From 50f71172e83f63750c7e2090630186f66c9194fa Mon Sep 17 00:00:00 2001
From: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Date: Sat, 25 Apr 2020 13:03:58 +0100
Subject: Add Haiku-specific patches for Rust 1.43.0


diff --git a/Cargo.lock b/Cargo.lock
index d41517c..480cbc6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1056,9 +1056,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
 
 [[package]]
 name = "filetime"
-version = "0.2.8"
+version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
+checksum = "f59efc38004c988e4201d11d263b8171f49a2e7ec0bdbb71773433f271504a5e"
 dependencies = [
  "cfg-if",
  "libc",
@@ -1760,9 +1760,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
 
 [[package]]
 name = "libc"
-version = "0.2.66"
+version = "0.2.69"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
+checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
 dependencies = [
  "rustc-std-workspace-core",
 ]
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
index 674d4c7..35992cb 100644
--- a/src/libstd/sys/unix/thread.rs
+++ b/src/libstd/sys/unix/thread.rs
@@ -183,7 +183,7 @@ impl Thread {
         unsafe {
             let ret = libc::pthread_join(self.id, ptr::null_mut());
             mem::forget(self);
-            assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret));
+            debug_assert_eq!(ret, 0);
         }
     }
 
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index 4d37734..592a065 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -255,7 +255,6 @@ pub const FILE_END: DWORD = 2;
 
 pub const WAIT_OBJECT_0: DWORD = 0x00000000;
 pub const WAIT_TIMEOUT: DWORD = 258;
-pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
 
 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs
index c828243..891cd4c 100644
--- a/src/libstd/sys/windows/thread.rs
+++ b/src/libstd/sys/windows/thread.rs
@@ -65,10 +65,7 @@ impl Thread {
     }
 
     pub fn join(self) {
-        let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
-        if rc == c::WAIT_FAILED {
-            panic!("failed to join on thread: {}", io::Error::last_os_error());
-        }
+        unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
     }
 
     pub fn yield_now() {
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 0dc43c7..13dd5a7 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -1465,11 +1465,6 @@ impl<T> JoinHandle<T> {
     /// [`panic`]: ../../std/macro.panic.html
     /// [atomic memory orderings]: ../../std/sync/atomic/index.html
     ///
-    /// # Panics
-    ///
-    /// This function may panic on some platforms if a thread attempts to join
-    /// itself or otherwise may create a deadlock with joining threads.
-    ///
     /// # Examples
     ///
     /// ```
-- 
2.19.0

