about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-23 07:18:17 +0000
committerbors <bors@rust-lang.org>2020-05-23 07:18:17 +0000
commit75b0a68f35a06fc7aed8aa95831df8eace4afffb (patch)
treeac84646e72ebb56c8a979e4f7c4b9a0b1ea08bb1 /src/libcore
parent7f940ef5d91b53e889f111f27e00849f2f5ae4a2 (diff)
parentbf1b998be6be2b3b8dee46acd5a3e6261457bdc2 (diff)
downloadrust-75b0a68f35a06fc7aed8aa95831df8eace4afffb.tar.gz
rust-75b0a68f35a06fc7aed8aa95831df8eace4afffb.zip
Auto merge of #72478 - Dylan-DPC:rollup-vval8du, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #71289 (Allow using `Self::` in doc)
 - #72375 (Improve E0599 explanation)
 - #72385 (Add some teams to prioritization exclude_labels)
 - #72395 (Allow rust-highfive to label issues it creates.)
 - #72453 (Add flag to open docs:  x.py doc --open)
 - #72459 (Add core::future::IntoFuture)
 - #72461 (Clean up E0600 explanation)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/future/into_future.rs27
-rw-r--r--src/libcore/future/mod.rs4
2 files changed, 31 insertions, 0 deletions
diff --git a/src/libcore/future/into_future.rs b/src/libcore/future/into_future.rs
new file mode 100644
index 00000000000..4020c254446
--- /dev/null
+++ b/src/libcore/future/into_future.rs
@@ -0,0 +1,27 @@
+use crate::future::Future;
+
+/// Conversion into a `Future`.
+#[unstable(feature = "into_future", issue = "67644")]
+pub trait IntoFuture {
+    /// The output that the future will produce on completion.
+    #[unstable(feature = "into_future", issue = "67644")]
+    type Output;
+
+    /// Which kind of future are we turning this into?
+    #[unstable(feature = "into_future", issue = "67644")]
+    type Future: Future<Output = Self::Output>;
+
+    /// Creates a future from a value.
+    #[unstable(feature = "into_future", issue = "67644")]
+    fn into_future(self) -> Self::Future;
+}
+
+#[unstable(feature = "into_future", issue = "67644")]
+impl<F: Future> IntoFuture for F {
+    type Output = F::Output;
+    type Future = F;
+
+    fn into_future(self) -> Self::Future {
+        self
+    }
+}
diff --git a/src/libcore/future/mod.rs b/src/libcore/future/mod.rs
index b5a102916a0..6f6009b47e6 100644
--- a/src/libcore/future/mod.rs
+++ b/src/libcore/future/mod.rs
@@ -10,12 +10,16 @@ use crate::{
 };
 
 mod future;
+mod into_future;
 mod pending;
 mod ready;
 
 #[stable(feature = "futures_api", since = "1.36.0")]
 pub use self::future::Future;
 
+#[unstable(feature = "into_future", issue = "67644")]
+pub use into_future::IntoFuture;
+
 #[unstable(feature = "future_readiness_fns", issue = "70921")]
 pub use pending::{pending, Pending};
 #[unstable(feature = "future_readiness_fns", issue = "70921")]