diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 5dee1d6dd3a3..da3aa8449baf 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -120,7 +120,7 @@ impl<'a, F: ?Sized + Future + Unpin> Future for &'a mut F { impl
Future for Pin
where - P: ops::DerefMut, + P: Unpin + ops::DerefMut, P::Target: Future, { type Output = <
::Target as Future>::Output;
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 44d632ece055..0d7ddfc20b6d 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -285,7 +285,7 @@ impl {
pointer: P,
@@ -200,10 +198,10 @@ impl<'a, T: ?Sized> Pin<&'a T> {
/// because it is one of the fields of that value), and also that you do
/// not move out of the argument you receive to the interior function.
#[unstable(feature = "pin", issue = "49150")]
- pub unsafe fn map_unchecked(this: Pin<&'a T>, func: F) -> Pin<&'a U> where
+ pub unsafe fn map_unchecked(self: Pin<&'a T>, func: F) -> Pin<&'a U> where
F: FnOnce(&T) -> &U,
{
- let pointer = &*this.pointer;
+ let pointer = &*self.pointer;
let new_pointer = func(pointer);
Pin::new_unchecked(new_pointer)
}
@@ -217,8 +215,8 @@ impl<'a, T: ?Sized> Pin<&'a T> {
/// with the same lifetime as the original `Pin`.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
- pub fn get_ref(this: Pin<&'a T>) -> &'a T {
- this.pointer
+ pub fn get_ref(self: Pin<&'a T>) -> &'a T {
+ self.pointer
}
}
@@ -226,8 +224,8 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// Convert this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
- pub fn into_ref(this: Pin<&'a mut T>) -> Pin<&'a T> {
- Pin { pointer: this.pointer }
+ pub fn into_ref(self: Pin<&'a mut T>) -> Pin<&'a T> {
+ Pin { pointer: self.pointer }
}
/// Get a mutable reference to the data inside of this `Pin`.
@@ -241,10 +239,10 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// with the same lifetime as the original `Pin`.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
- pub fn get_mut(this: Pin<&'a mut T>) -> &'a mut T
+ pub fn get_mut(self: Pin<&'a mut T>) -> &'a mut T
where T: Unpin,
{
- this.pointer
+ self.pointer
}
/// Get a mutable reference to the data inside of this `Pin`.
@@ -259,8 +257,8 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// instead.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
- pub unsafe fn get_mut_unchecked(this: Pin<&'a mut T>) -> &'a mut T {
- this.pointer
+ pub unsafe fn get_unchecked_mut(self: Pin<&'a mut T>) -> &'a mut T {
+ self.pointer
}
/// Construct a new pin by mapping the interior value.
@@ -275,10 +273,10 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// because it is one of the fields of that value), and also that you do
/// not move out of the argument you receive to the interior function.
#[unstable(feature = "pin", issue = "49150")]
- pub unsafe fn map_unchecked_mut(this: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where
+ pub unsafe fn map_unchecked_mut(self: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where
F: FnOnce(&mut T) -> &mut U,
{
- let pointer = Pin::get_mut_unchecked(this);
+ let pointer = Pin::get_unchecked_mut(self);
let new_pointer = func(pointer);
Pin::new_unchecked(new_pointer)
}
@@ -342,6 +340,3 @@ impl<'a, P, U> DispatchFromDyn
where
P: DispatchFromDyn,
{}
-
-#[unstable(feature = "pin", issue = "49150")]
-impl Unpin for Pin {}
diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs
index 45f629a64424..a1e6034b2082 100644
--- a/src/libcore/prelude/v1.rs
+++ b/src/libcore/prelude/v1.rs
@@ -19,7 +19,7 @@
// Re-exported core operators
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)]
-pub use marker::{Copy, Send, Sized, Sync};
+pub use marker::{Copy, Send, Sized, Sync, Unpin};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)]
pub use ops::{Drop, Fn, FnMut, FnOnce};
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index d5e6cab948b8..3379be79186e 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -43,7 +43,7 @@ impl