Skip to content

Commit 923c122

Browse files
committed
Always mention Box::pin when dealing with !Unpin
1 parent 7528cc3 commit 923c122

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Diff for: library/core/src/marker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
765765
/// [`pin` module]: crate::pin
766766
#[stable(feature = "pin", since = "1.33.0")]
767767
#[rustc_on_unimplemented(
768-
on(_Self = "std::future::Future", note = "consider using `Box::pin`",),
768+
note = "consider using `Box::pin`",
769769
message = "`{Self}` cannot be unpinned"
770770
)]
771771
#[lang = "unpin"]

Diff for: src/test/ui/async-await/pin-needed-to-poll-2.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned
44
LL | Pin::new(&mut self.sleep).poll(cx)
55
| ^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned`
66
|
7+
= note: consider using `Box::pin`
78
note: required because it appears within the type `Sleep`
89
--> $DIR/pin-needed-to-poll-2.rs:8:8
910
|

Diff for: src/test/ui/generator/static-not-unpin.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | fn assert_unpin<T: Unpin>(_: T) {
66
...
77
LL | assert_unpin(generator);
88
| ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]`
9+
|
10+
= note: consider using `Box::pin`
911

1012
error: aborting due to previous error
1113

0 commit comments

Comments
 (0)