Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in https://docs.rs/async-std/latest/async_std/#examples ? #1071

Open
alexpdp7 opened this issue Jan 22, 2024 · 1 comment
Open

Errors in https://docs.rs/async-std/latest/async_std/#examples ? #1071

alexpdp7 opened this issue Jan 22, 2024 · 1 comment

Comments

@alexpdp7
Copy link

alexpdp7 commented Jan 22, 2024

I might be doing PEBCAK, but the second example in:

https://docs.rs/async-std/latest/async_std/#examples

, namely:

use async_std::prelude::*;

#[async_std::main]
async fn main() {
    let a = async { 1u8 };
    let b = async { 2u8 };
    assert_eq!(a.join(b).await, (1u8, 2u8))
}

results for me in:

warning: unused import: `async_std::prelude::*`
 --> src/main.rs:1:5
  |
1 | use async_std::prelude::*;
  |     ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0599]: no method named `join` found for `async` block `{async block@src/main.rs:5:13: 5:26}` in the current scope
 --> src/main.rs:7:18
  |
7 |     assert_eq!(a.join(b).await, (1u8, 2u8))
  |                  ^^^^ method not found in `{async block@src/main.rs:5:13: 5:26}`

For more information about this error, try `rustc --explain E0599`.
warning: `foo` (bin "foo") generated 1 warning
error: could not compile `foo` (bin "foo") due to previous error; 1 warning emitted

, whereas the other two examples work OOB.

@alexpdp7
Copy link
Author

(Just a note needed that unstable is needed. I can send a PR if appropriate.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant