Always mention Box::pin
when dealing with !Unpin
This commit is contained in:
parent
8bc5581978
commit
dc71166037
@ -765,7 +765,7 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
|
||||
/// [`pin` module]: crate::pin
|
||||
#[stable(feature = "pin", since = "1.33.0")]
|
||||
#[rustc_on_unimplemented(
|
||||
on(_Self = "std::future::Future", note = "consider using `Box::pin`",),
|
||||
note = "consider using `Box::pin`",
|
||||
message = "`{Self}` cannot be unpinned"
|
||||
)]
|
||||
#[lang = "unpin"]
|
||||
|
@ -4,6 +4,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned
|
||||
LL | Pin::new(&mut self.sleep).poll(cx)
|
||||
| ^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned`
|
||||
|
|
||||
= note: consider using `Box::pin`
|
||||
note: required because it appears within the type `Sleep`
|
||||
--> $DIR/pin-needed-to-poll-2.rs:8:8
|
||||
|
|
||||
|
@ -6,6 +6,8 @@ LL | fn assert_unpin<T: Unpin>(_: T) {
|
||||
...
|
||||
LL | assert_unpin(generator);
|
||||
| ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]`
|
||||
|
|
||||
= note: consider using `Box::pin`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user