rust/patches/0015-Remove-usage-of-unsized-locals.patch
2019-07-29 14:35:15 +02:00

111 lines
3.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/at_exit_imp.rs b/src/libstd/sys_common/at_exit_imp.rs
index 1181b86..20f9251 100644
--- a/src/libstd/sys_common/at_exit_imp.rs
+++ b/src/libstd/sys_common/at_exit_imp.rs
@@ -38,6 +38,7 @@ unsafe fn init() -> bool {
true
}
+/*
pub fn cleanup() {
for i in 1..=ITERS {
unsafe {
@@ -60,6 +61,7 @@ pub fn cleanup() {
}
}
}
+*/
pub fn push(f: Box<dyn FnOnce()>) -> bool {
unsafe {
diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs
index 6260c3b..611ed7e 100644
--- a/src/libstd/sys_common/mod.rs
+++ b/src/libstd/sys_common/mod.rs
@@ -127,7 +127,6 @@ pub fn cleanup() {
CLEANUP.call_once(|| unsafe {
sys::args::cleanup();
sys::stack_overflow::cleanup();
- at_exit_imp::cleanup();
});
}
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,12 +6,7 @@ use crate::sys::thread as imp;
#[allow(dead_code)]
pub unsafe fn start_thread(main: *mut u8) {
- // Next, set up our stack overflow handler which may get triggered if we run
- // out of stack.
- let _handler = stack_overflow::Handler::new();
-
- // Finally, let's run some code.
- Box::from_raw(main as *mut Box<dyn FnOnce()>)()
+ panic!("Threads are not yet supported, because cranelift doesn't support atomics.");
}
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,6 +40,8 @@ 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!("Threads are not yet 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)