|
| 1 | +From 7403e2998345ef0650fd50628d7098d4d1e88e5c Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Sat, 6 Apr 2019 12:16:21 +0200 |
| 4 | +Subject: [PATCH] Remove usage of unsized locals |
| 5 | + |
| 6 | +--- |
| 7 | + src/liballoc/boxed.rs | 23 ----------------------- |
| 8 | + src/libstd/sys_common/at_exit_imp.rs | 2 ++ |
| 9 | + src/libstd/sys_common/mod.rs | 1 - |
| 10 | + src/libstd/sys_common/thread.rs | 7 +------ |
| 11 | + 4 files changed, 3 insertions(+), 30 deletions(-) |
| 12 | + |
| 13 | +diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs |
| 14 | +index f6dee7c..0c6a8c0 100644 |
| 15 | +--- a/src/liballoc/boxed.rs |
| 16 | ++++ b/src/liballoc/boxed.rs |
| 17 | +@@ -694,29 +694,6 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> { |
| 18 | + #[stable(feature = "fused", since = "1.26.0")] |
| 19 | + impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {} |
| 20 | + |
| 21 | +-#[stable(feature = "boxed_closure_impls", since = "1.35.0")] |
| 22 | +-impl<A, F: FnOnce<A> + ?Sized> FnOnce<A> for Box<F> { |
| 23 | +- type Output = <F as FnOnce<A>>::Output; |
| 24 | +- |
| 25 | +- extern "rust-call" fn call_once(self, args: A) -> Self::Output { |
| 26 | +- <F as FnOnce<A>>::call_once(*self, args) |
| 27 | +- } |
| 28 | +-} |
| 29 | +- |
| 30 | +-#[stable(feature = "boxed_closure_impls", since = "1.35.0")] |
| 31 | +-impl<A, F: FnMut<A> + ?Sized> FnMut<A> for Box<F> { |
| 32 | +- extern "rust-call" fn call_mut(&mut self, args: A) -> Self::Output { |
| 33 | +- <F as FnMut<A>>::call_mut(self, args) |
| 34 | +- } |
| 35 | +-} |
| 36 | +- |
| 37 | +-#[stable(feature = "boxed_closure_impls", since = "1.35.0")] |
| 38 | +-impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> { |
| 39 | +- extern "rust-call" fn call(&self, args: A) -> Self::Output { |
| 40 | +- <F as Fn<A>>::call(self, args) |
| 41 | +- } |
| 42 | +-} |
| 43 | +- |
| 44 | + /// `FnBox` is a version of the `FnOnce` intended for use with boxed |
| 45 | + /// closure objects. The idea is that where one would normally store a |
| 46 | + /// `Box<dyn FnOnce()>` in a data structure, you should use |
| 47 | +diff --git a/src/libstd/sys_common/at_exit_imp.rs b/src/libstd/sys_common/at_exit_imp.rs |
| 48 | +index 1181b86..20f9251 100644 |
| 49 | +--- a/src/libstd/sys_common/at_exit_imp.rs |
| 50 | ++++ b/src/libstd/sys_common/at_exit_imp.rs |
| 51 | +@@ -38,6 +38,7 @@ unsafe fn init() -> bool { |
| 52 | + true |
| 53 | + } |
| 54 | + |
| 55 | ++/* |
| 56 | + pub fn cleanup() { |
| 57 | + for i in 1..=ITERS { |
| 58 | + unsafe { |
| 59 | +@@ -60,6 +61,7 @@ pub fn cleanup() { |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | ++*/ |
| 64 | + |
| 65 | + pub fn push(f: Box<dyn FnBox()>) -> bool { |
| 66 | + unsafe { |
| 67 | +diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs |
| 68 | +index 6260c3b..611ed7e 100644 |
| 69 | +--- a/src/libstd/sys_common/mod.rs |
| 70 | ++++ b/src/libstd/sys_common/mod.rs |
| 71 | +@@ -127,7 +127,6 @@ pub fn cleanup() { |
| 72 | + CLEANUP.call_once(|| unsafe { |
| 73 | + sys::args::cleanup(); |
| 74 | + sys::stack_overflow::cleanup(); |
| 75 | +- at_exit_imp::cleanup(); |
| 76 | + }); |
| 77 | + } |
| 78 | + |
| 79 | +diff --git a/src/libstd/sys_common/thread.rs b/src/libstd/sys_common/thread.rs |
| 80 | +index b2142e7..718bb1c 100644 |
| 81 | +--- a/src/libstd/sys_common/thread.rs |
| 82 | ++++ b/src/libstd/sys_common/thread.rs |
| 83 | +@@ -6,12 +6,7 @@ use crate::sys::thread as imp; |
| 84 | + |
| 85 | + #[allow(dead_code)] |
| 86 | + pub unsafe fn start_thread(main: *mut u8) { |
| 87 | +- // Next, set up our stack overflow handler which may get triggered if we run |
| 88 | +- // out of stack. |
| 89 | +- let _handler = stack_overflow::Handler::new(); |
| 90 | +- |
| 91 | +- // Finally, let's run some code. |
| 92 | +- Box::from_raw(main as *mut Box<dyn FnBox()>)() |
| 93 | ++ panic!("Threads are not yet supported, because cranelift doesn't support atomics."); |
| 94 | + } |
| 95 | + |
| 96 | + pub fn min_stack() -> usize { |
| 97 | +-- |
| 98 | +2.20.1 (Apple Git-117) |
| 99 | + |
0 commit comments