about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorWithout Boats <boats@mozilla.com>2018-09-01 06:12:10 +0200
committerWithout Boats <boats@mozilla.com>2018-09-01 06:57:58 +0200
commit974bdc80fe3214159dc30e0bbb76694900e613c0 (patch)
treea4ce3c775b9c740ffffb0d7609fe14520fe1ec94 /src/libstd
parente6b35b0e1115f008796e8313574e4a4739b6d39d (diff)
downloadrust-974bdc80fe3214159dc30e0bbb76694900e613c0.tar.gz
rust-974bdc80fe3214159dc30e0bbb76694900e613c0.zip
Update to a new pinning API.
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 310475d31fd..fac8c35b9c9 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -436,7 +436,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 6945a41a5e7..b9a709d80be 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)
     }
 }