Closed
Description
Given the following code:
use futures::stream::{self, StreamExt};
#[tokio::main]
async fn main() {
let key1: String = "/helloa".to_string();
dbg!(&key1);
let futlist = stream::iter(0..10);
let _stringvec: Vec<String> = futlist.map(|_| {
async {
key1.clone()
}
}).buffer_unordered(10).collect::<Vec<String>>().await;
printn!("hi");
}
The current output is:
Compiling playground v0.0.1 (/playground)
error: cannot find macro `printn` in this scope
--> src/main.rs:15:5
|
15 | printn!("hi");
| ^^^^^^ help: a macro with a similar name exists: `print`
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:9:9
|
9 | let futlist = stream::iter(0..10);
| ^^^^^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ^^^^^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:10:47
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| _______________________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |_____^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |______^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |___________________________^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |____________________________________________________^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:10:35
|
10 | let _stringvec: Vec<String> = futlist.map(|_| {
| ___________________________________^
11 | | async {
12 | | key1.clone()
13 | | }
14 | | }).buffer_unordered(10).collect::<Vec<String>>().await;
| |__________________________________________________________^
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0698`.
error: could not compile `playground`
To learn more, run the command again with --verbose.
Ideally the output should look like:
Only the first error should be shown
Compiling playground v0.0.1 (/playground)
error: cannot find macro `printn` in this scope
--> src/main.rs:15:5
|
15 | printn!("hi");
| ^^^^^^ help: a macro with a similar name exists: `print`