From 7403e2998345ef0650fd50628d7098d4d1e88e5c Mon Sep 17 00:00:00 2001 From: bjorn3 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 ExactSizeIterator for Box { #[stable(feature = "fused", since = "1.26.0")] impl FusedIterator for Box {} -#[stable(feature = "boxed_closure_impls", since = "1.35.0")] -impl + ?Sized> FnOnce for Box { - type Output = >::Output; - - extern "rust-call" fn call_once(self, args: A) -> Self::Output { - >::call_once(*self, args) - } -} - -#[stable(feature = "boxed_closure_impls", since = "1.35.0")] -impl + ?Sized> FnMut for Box { - extern "rust-call" fn call_mut(&mut self, args: A) -> Self::Output { - >::call_mut(self, args) - } -} - -#[stable(feature = "boxed_closure_impls", since = "1.35.0")] -impl + ?Sized> Fn for Box { - extern "rust-call" fn call(&self, args: A) -> Self::Output { - >::call(self, args) - } -} - #[unstable(feature = "coerce_unsized", issue = "27732")] impl, U: ?Sized> CoerceUnsized> for Box {} 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) -> 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)() + 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,5 +40,7 @@ impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements pub unsafe fn new(stack: usize, p: Box) -> io::Result { + 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)