Hello everyone,
I'm encountering an issue while compiling my project that uses ashpd (v0.10.2). When building, I receive errors related to unresolved modules and missing trait methods from the futures_lite
crate. Here are the relevant error messages:
error[E0433]: failed to resolve: use of undeclared crate or module `futures_lite`
--> /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.10.2/src/helpers.rs:4:5
|
4 | use futures_lite::io::AsyncReadExt;
| ^^^^^^^^^^^^ use of undeclared crate or module `futures_lite`
help: there is a crate or module with a similar name
|
4 | use futures_util::io::AsyncReadExt;
| ~~~~~~~~~~~~
error[E0432]: unresolved import `futures_util::AsyncReadExt`
--> /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.10.2/src/desktop/secret.rs:26:5
|
26 | use futures_util::AsyncReadExt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AsyncReadExt` in the root
note: found an item that was configured out
--> /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.31/src/lib.rs:320:47
|
320 | AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt, AsyncWrite,
| ^^^^^^^^^^^^
note: the item is gated behind the `io` feature
--> /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.31/src/lib.rs:316:7
|
316 | #[cfg(feature = "io")]
| ^^^^^^^^^^^^^^
error[E0599]: no method named `read_to_string` found for struct `async_fs::File` in the current scope
--> /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.10.2/src/helpers.rs:28:16
|
28 | match file.read_to_string(&mut buffer).await {
| ^^^^^^^^^^^^^^ method not found in `File`
|
::: /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.6.0/src/io.rs:2059:8
|
2059 | fn read_to_string<'a>(&'a mut self, buf: &'a mut String) -> ReadToStringFuture<'a, Self>
| -------------- the method is available for `async_fs::File` here
= help: items from traits can only be used if the trait is in scope
help: trait `AsyncReadExt` which provides `read_to_string` is implemented but not in scope; perhaps you want to import it
|
1 + use futures_lite::io::AsyncReadExt;
|
help: there is a method `read_to_end` with a similar name
|
28 | match file.read_to_end(&mut buffer).await {
| ~~~~~~~~~~~
error[E0599]: no method named `read_to_end` found for struct `async_net::unix::UnixStream` in the current scope
--> /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.10.2/src/desktop/secret.rs:113:8
|
113 | x1.read_to_end(&mut buf).await?;
| ^^^^^^^^^^^ method not found in `UnixStream`
|
::: /home/ericsonwillians/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.6.0/src/io.rs:2029:8
|
2029 | fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEndFuture<'a, Self>
| ----------- the method is available for `async_net::unix::UnixStream` here
= help: items from traits can only be used if the trait is in scope
help: trait `AsyncReadExt` which provides `read_to_end` is implemented but not in scope; perhaps you want to import it
|
21 + use futures_lite::io::AsyncReadExt;
What I’ve Tried
-
Adding
futures-lite
as a Dependency:
I addedfutures-lite = { version = "2.6.0", features = ["std"] }
to myCargo.toml
and even tried to "rename" it so that downstream crates can refer to it asfutures_lite
. -
Patching
futures-lite
:
I added a[patch.crates-io]
section to redirect dependencies to the Git repository offutures-lite
(using the master branch). -
Selecting a Single Async Runtime:
I experimented with disabling ashpd's default features and enabling only a single async runtime (either"async-std"
or"tokio"
) to avoid conflicts, but the errors still persist.
My Environment
- ashpd version: 0.10.2 (or Git version if applicable)
- futures-lite version: 2.6.0
- futures-util version: 0.3.31
- Rust edition: 2021
Questions
- Has anyone experienced similar issues with ashpd and the
futures_lite
dependency? - Is there a known workaround or a patch I can apply in my
Cargo.toml
to resolve these module/trait resolution errors? - Should I consider using a different version of ashpd or applying a Git patch to fix these problems?
Any help or pointers would be greatly appreciated!
Thanks in advance!