Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- async fn foo() { 5 } foo().await
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> src/main.rs:6:30
- |
- 4 | fn main() {
- | ---- this is not `async`
- 5 | println!("{:?}", {
- 6 | async fn foo() { 5 } foo().await
- | ^^^^^^^^^^^ only allowed inside `async` functions and blocks
- error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
- --> src/main.rs:6:24
- |
- 6 | async fn foo() { 5 } foo().await
- | ^ expected integer, found ()
- |
- = note: expected type `{integer}`
- found type `()`
- = note: the return type of a function must have a statically known size
- error: aborting due to 2 previous errors
- For more information about this error, try `rustc --explain E0271`.
- 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