Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- #![feature(async_await)]
- fn main() {
- println!("{:?}", {
- use std::future::Future; async fn foo() { println!("this wont run"); } async fn foo2() { foo.await; } let mut state = foo2(); let waker = std::ptr::null_mut() as *mut std::task::Context; unsafe { std::pin::Pin::new_unchecked(&mut state).poll(&mut * waker) }
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0277]: the trait bound `fn() -> impl std::future::Future {main::foo}: std::future::Future` is not satisfied
- --> src/main.rs:6:99
- |
- 6 | use std::future::Future; async fn foo() { println!("this wont run"); } async fn foo2() { foo.await; } let mut state = foo2(); let waker = std::ptr::null_mut() as *mut std::task::Context; unsafe { std::pin::Pin::new_unchecked(&mut state).poll(&mut * waker) }
- | ^^^^^^^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {main::foo}`
- |
- = note: required by `std::future::poll_with_tls_context`
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0277`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement