rust/patches/0015-Remove-usage-of-unsized-locals.patch
2020-01-22 20:24:17 +01:00

74 lines
2.8 KiB
Diff

From 7403e2998345ef0650fd50628d7098d4d1e88e5c Mon Sep 17 00:00:00 2001
From: bjorn3 <bjorn3@users.noreply.github.com>
Date: Sat, 6 Apr 2019 12:16:21 +0200
Subject: [PATCH] Remove usage of unsized locals
---
src/liballoc/boxed.rs | 23 -----------------------
src/libstd/sys_common/at_exit_imp.rs | 2 ++
src/libstd/sys_common/mod.rs | 1 -
src/libstd/sys_common/thread.rs | 7 +------
4 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index f6dee7c..0c6a8c0 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -694,29 +694,6 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {
#[stable(feature = "fused", since = "1.26.0")]
impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
-#[stable(feature = "boxed_closure_impls", since = "1.35.0")]
-impl<A, F: FnOnce<A> + ?Sized> FnOnce<A> for Box<F> {
- type Output = <F as FnOnce<A>>::Output;
-
- extern "rust-call" fn call_once(self, args: A) -> Self::Output {
- <F as FnOnce<A>>::call_once(*self, args)
- }
-}
-
-#[stable(feature = "boxed_closure_impls", since = "1.35.0")]
-impl<A, F: FnMut<A> + ?Sized> FnMut<A> for Box<F> {
- extern "rust-call" fn call_mut(&mut self, args: A) -> Self::Output {
- <F as FnMut<A>>::call_mut(self, args)
- }
-}
-
-#[stable(feature = "boxed_closure_impls", since = "1.35.0")]
-impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> {
- extern "rust-call" fn call(&self, args: A) -> Self::Output {
- <F as Fn<A>>::call(self, args)
- }
-}
-
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
diff --git a/src/libstd/sys_common/thread.rs b/src/libstd/sys_common/thread.rs
index b2142e7..718bb1c 100644
--- a/src/libstd/sys_common/thread.rs
+++ b/src/libstd/sys_common/thread.rs
@@ -6,7 +6,7 @@ pub unsafe fn start_thread(main: *mut u8) {
let _handler = stack_overflow::Handler::new();
// Finally, let's run some code.
- Box::from_raw(main as *mut Box<dyn FnOnce()>)()
+ Box::from_raw(main as *mut Box<dyn FnBox()>)()
}
pub fn min_stack() -> usize {
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
index f4a1783..362b537 100644
--- a/src/libstd/sys/unix/thread.rs
+++ b/src/libstd/sys/unix/thread.rs
@@ -40,5 +40,7 @@ impl Thread {
// unsafe: see thread::Builder::spawn_unchecked for safety requirements
pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> {
+ panic!("Warning: Threads are not yet fully supported, because cranelift doesn't support atomics.");
+
let p = box p;
let mut native: libc::pthread_t = mem::zeroed();
let mut attr: libc::pthread_attr_t = mem::zeroed();
--
2.20.1 (Apple Git-117)