about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-19 06:56:19 +0000
committerbors <bors@rust-lang.org>2018-09-19 06:56:19 +0000
commit1e21c9a297a9fe668d62887a3a6a4add8e717b17 (patch)
treee027144fdbb18bb3d12fe5b63fff4a605e65c372 /src/libstd
parentff6422d7a392acfc8af28994d65af2bbaecea4f6 (diff)
parent574bca7262f0ddab9e1818253012dbff34755b98 (diff)
downloadrust-1e21c9a297a9fe668d62887a3a6a4add8e717b17.tar.gz
rust-1e21c9a297a9fe668d62887a3a6a4add8e717b17.zip
Auto merge of #53877 - withoutboats:compositional-pin, r=aturon
Update to a new pinning API.

~~Blocked on #53843 because of method resolution problems with new pin type.~~

@r? @cramertj

cc @RalfJung @pythonesque anyone interested in #49150
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/future.rs10
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libstd/macros.rs2
-rw-r--r--src/libstd/panic.rs8
4 files changed, 11 insertions, 11 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index d9657f691c7..262646738cf 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -12,7 +12,7 @@
 
 use core::cell::Cell;
 use core::marker::Unpin;
-use core::pin::PinMut;
+use core::pin::Pin;
 use core::option::Option;
 use core::ptr::NonNull;
 use core::task::{self, Poll};
@@ -42,8 +42,8 @@ impl<T: Generator<Yield = ()>> !Unpin for GenFuture<T> {}
 #[unstable(feature = "gen_future", issue = "50547")]
 impl<T: Generator<Yield = ()>> Future for GenFuture<T> {
     type Output = T::Return;
-    fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
-        set_task_cx(cx, || match unsafe { PinMut::get_mut_unchecked(self).0.resume() } {
+    fn poll(self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Self::Output> {
+        set_task_cx(cx, || match unsafe { Pin::get_mut_unchecked(self).0.resume() } {
             GeneratorState::Yielded(()) => Poll::Pending,
             GeneratorState::Complete(x) => Poll::Ready(x),
         })
@@ -108,9 +108,9 @@ where
 
 #[unstable(feature = "gen_future", issue = "50547")]
 /// Polls a future in the current thread-local task context.
-pub fn poll_in_task_cx<F>(f: PinMut<F>) -> Poll<F::Output>
+pub fn poll_in_task_cx<F>(f: Pin<&mut F>) -> Poll<F::Output>
 where
     F: Future
 {
-    get_task_cx(|cx| f.poll(cx))
+    get_task_cx(|cx| F::poll(f, cx))
 }
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 17f6923eae7..1eb76d6c45e 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -435,7 +435,7 @@ pub use alloc_crate::fmt;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use alloc_crate::format;
 #[unstable(feature = "pin", issue = "49150")]
-pub use alloc_crate::pin;
+pub use core::pin;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use alloc_crate::slice;
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index b649ec2340e..e60ef46e738 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -230,7 +230,7 @@ macro_rules! await {
         loop {
             if let $crate::task::Poll::Ready(x) =
                 $crate::future::poll_in_task_cx(unsafe {
-                    $crate::pin::PinMut::new_unchecked(&mut pinned)
+                    $crate::pin::Pin::new_unchecked(&mut pinned)
                 })
             {
                 break x;
diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs
index 47547aedcbd..bd7a92e9b3f 100644
--- a/src/libstd/panic.rs
+++ b/src/libstd/panic.rs
@@ -16,7 +16,7 @@ use any::Any;
 use cell::UnsafeCell;
 use fmt;
 use future::Future;
-use pin::PinMut;
+use pin::Pin;
 use ops::{Deref, DerefMut};
 use panicking;
 use ptr::{Unique, NonNull};
@@ -327,9 +327,9 @@ impl<T: fmt::Debug> fmt::Debug for AssertUnwindSafe<T> {
 impl<'a, F: Future> Future for AssertUnwindSafe<F> {
     type Output = F::Output;
 
-    fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
-        let pinned_field = unsafe { PinMut::map_unchecked(self, |x| &mut x.0) };
-        pinned_field.poll(cx)
+    fn poll(self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Self::Output> {
+        let pinned_field = unsafe { Pin::map_unchecked_mut(self, |x| &mut x.0) };
+        F::poll(pinned_field, cx)
     }
 }