Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Point at
impl
and type defs introducing requirements on E0277
- Loading branch information
Showing
55 changed files
with
621 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use std::{ | ||
future::Future, | ||
pin::Pin, | ||
marker::Unpin, | ||
task::{Context, Poll}, | ||
}; | ||
|
||
struct Sleep(std::marker::PhantomPinned); | ||
|
||
impl Future for Sleep { | ||
type Output = (); | ||
|
||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | ||
Poll::Ready(()) | ||
} | ||
} | ||
|
||
impl Drop for Sleep { | ||
fn drop(&mut self) {} | ||
} | ||
|
||
fn sleep() -> Sleep { | ||
Sleep(std::marker::PhantomPinned) | ||
} | ||
|
||
|
||
struct MyFuture { | ||
sleep: Sleep, | ||
} | ||
|
||
impl MyFuture { | ||
fn new() -> Self { | ||
Self { | ||
sleep: sleep(), | ||
} | ||
} | ||
} | ||
|
||
impl Future for MyFuture { | ||
type Output = (); | ||
|
||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | ||
Pin::new(&mut self.sleep).poll(cx) | ||
//~^ ERROR `PhantomPinned` cannot be unpinned | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error[E0277]: `PhantomPinned` cannot be unpinned | ||
--> $DIR/pin-needed-to-poll-2.rs:43:9 | ||
| | ||
LL | Pin::new(&mut self.sleep).poll(cx) | ||
| ^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned` | ||
| | ||
note: required because it appears within the type `Sleep` | ||
--> $DIR/pin-needed-to-poll-2.rs:8:8 | ||
| | ||
LL | struct Sleep(std::marker::PhantomPinned); | ||
| ^^^^^ | ||
= note: required by `Pin::<P>::new` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.