about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMasaki Hara <ackie.h.gmai@gmail.com>2019-02-11 10:34:24 +0900
committerCrLF0710 <crlf0710@gmail.com>2019-04-05 02:27:05 +0800
commit45c0b28bcb6e383cd9d24d3845ee8accda31c889 (patch)
tree4bd485ac20f3d0bbc2921abe2492245324c315d7
parenta38f29272ef4d04f0cc77e4f8d4fa5fac7ed746d (diff)
downloadrust-45c0b28bcb6e383cd9d24d3845ee8accda31c889.tar.gz
rust-45c0b28bcb6e383cd9d24d3845ee8accda31c889.zip
Remove FnBox specialization of impl FnOnce for Box<impl FnOnce>.
-rw-r--r--src/liballoc/boxed.rs18
-rw-r--r--src/test/ui/unsized-locals/fnbox-compat.rs13
-rw-r--r--src/test/ui/unsized-locals/fnbox-compat.stderr11
3 files changed, 1 insertions, 41 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 864add1ecfe..d4fe8be36d6 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -700,7 +700,7 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
 impl<A, F: FnOnce<A> + ?Sized> FnOnce<A> for Box<F> {
     type Output = <F as FnOnce<A>>::Output;
 
-    default extern "rust-call" fn call_once(self, args: A) -> Self::Output {
+    extern "rust-call" fn call_once(self, args: A) -> Self::Output {
         <F as FnOnce<A>>::call_once(*self, args)
     }
 }
@@ -777,22 +777,6 @@ impl<A, F> FnBox<A> for F
     }
 }
 
-#[unstable(feature = "fnbox",
-           reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
-impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + '_> {
-    extern "rust-call" fn call_once(self, args: A) -> R {
-        self.call_box(args)
-    }
-}
-
-#[unstable(feature = "fnbox",
-           reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
-impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + Send + '_> {
-    extern "rust-call" fn call_once(self, args: A) -> R {
-        self.call_box(args)
-    }
-}
-
 #[unstable(feature = "coerce_unsized", issue = "27732")]
 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
 
diff --git a/src/test/ui/unsized-locals/fnbox-compat.rs b/src/test/ui/unsized-locals/fnbox-compat.rs
deleted file mode 100644
index c2c385e9fea..00000000000
--- a/src/test/ui/unsized-locals/fnbox-compat.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#![feature(fnbox)]
-
-use std::boxed::FnBox;
-
-fn call_it<T>(f: Box<dyn FnBox(&i32) -> T>) -> T {
-    f(&42)
-    //~^ERROR implementation of `std::ops::FnOnce` is not general enough
-}
-
-fn main() {
-    let s = "hello".to_owned();
-    assert_eq!(&call_it(Box::new(|_| s)) as &str, "hello");
-}
diff --git a/src/test/ui/unsized-locals/fnbox-compat.stderr b/src/test/ui/unsized-locals/fnbox-compat.stderr
deleted file mode 100644
index c37bfaa47f7..00000000000
--- a/src/test/ui/unsized-locals/fnbox-compat.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error: implementation of `std::ops::FnOnce` is not general enough
-  --> $DIR/fnbox-compat.rs:6:5
-   |
-LL |     f(&42)
-   |     ^^^^^^
-   |
-   = note: `std::ops::FnOnce<(&'0 i32,)>` would have to be implemented for the type `std::boxed::Box<(dyn for<'r> std::boxed::FnBox<(&'r i32,), Output=T> + 'static)>`, for some specific lifetime `'0`
-   = note: but `std::ops::FnOnce<(&'1 i32,)>` is actually implemented for the type `std::boxed::Box<(dyn std::boxed::FnBox<(&'1 i32,), Output=T> + '_)>`, for some specific lifetime `'1`
-
-error: aborting due to previous error
-