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

unresolved import async_std::net with rcon-0.5.0 #21

Closed
anatawa12 opened this issue Aug 27, 2021 · 4 comments
Closed

unresolved import async_std::net with rcon-0.5.0 #21

anatawa12 opened this issue Aug 27, 2021 · 4 comments

Comments

@anatawa12
Copy link
Contributor

error[E0432]: unresolved import `async_std::net`
  --> /Users/anatawa12/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rcon-0.5.0/src/lib.rs:14:16
   |
14 | use async_std::net::{TcpStream, ToSocketAddrs};
   |                ^^^ could not find `net` in `async_std`

error[E0432]: unresolved import `async_std::task`
  --> /Users/anatawa12/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rcon-0.5.0/src/lib.rs:15:16
   |
15 | use async_std::task::sleep;
   |                ^^^^ could not find `task` in `async_std`

error[E0433]: failed to resolve: could not find `io` in `async_std`
  --> /Users/anatawa12/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rcon-0.5.0/src/packet.rs:11:16
   |
11 | use async_std::io::{Read, ReadExt, Write, prelude::WriteExt};
   |                ^^ could not find `io` in `async_std`

error[E0432]: unresolved import `async_std::io`
  --> /Users/anatawa12/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/rcon-0.5.0/src/packet.rs:11:16
   |
11 | use async_std::io::{Read, ReadExt, Write, prelude::WriteExt};
   |                ^^ could not find `io` in `async_std`

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `rcon`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
Process finished with exit code 101
@anatawa12
Copy link
Contributor Author

anatawa12 commented Aug 27, 2021

workaround: add async-std = "1" to dependencies

@panicbit
Copy link
Owner

panicbit commented Aug 27, 2021

Hi there! Thanks for reporting this quirky issue!

The issue seems to be that we are missing a few async-std feature flags, so this is easy to fix.
The reason why this slipped through the cracks is because the project builds and checks completely fine.
Why? Because cargo's version 1 resolver seems to have a quirk that wrongly pulls in features from dev-dependencies even if you are doing a normal cargo check or cargo build.
See rust-lang/cargo#1796.

This behaviour can be fixed by using resolver = "2" in the the Cargo.toml to avoid this kind of issue in the future.
See the resolver v2 documentation.

I will have this fixed and published in a couple of minutes.

@panicbit
Copy link
Owner

It also looks like there is no point in disabling default features in async-std since the net module can only be enabled via the default feature:

https://github.com/async-rs/async-std/blob/5640a7ff1f8ca5ff157f26a9ccb47a0b95d22fb4/src/lib.rs#L314-L321

@panicbit
Copy link
Owner

panicbit commented Aug 27, 2021

Published a fix as 0.5.1 on crates.io.
After running cargo update -p rcon you should be able to remove async-std = "1" from your Cargo.toml.
No workaround should be needed anymore.

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

2 participants