Skip to content

Unable to build tokio-postgres 0.7.7 #956

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

Closed
gerob311 opened this issue Oct 7, 2022 · 7 comments · Fixed by #982
Closed

Unable to build tokio-postgres 0.7.7 #956

gerob311 opened this issue Oct 7, 2022 · 7 comments · Fixed by #982

Comments

@gerob311
Copy link

gerob311 commented Oct 7, 2022

I'm using rust-postgres as a dependency for my project, and I'm getting the following error when I build my project.

error[E0432]: unresolved imports `futures_util::Future`, `futures_util::Stream`
 --> /Users/gerob/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-postgres-0.7.7/src/connect.rs:7:37
  |
7 | use futures_util::{future, pin_mut, Future, FutureExt, Stream};
  |                                     ^^^^^^             ^^^^^^ no `Stream` in the root
  |                                     |
  |                                     no `Future` in the root
  |
help: a similar name exists in the module
  |
7 | use futures_util::{future, pin_mut, future, FutureExt, Stream};
  |                                     ~~~~~~
help: a similar name exists in the module
  |
7 | use futures_util::{future, pin_mut, Future, FutureExt, stream};
  |   

There seems to be similar problems with the case of imports of Stream and Future in

  • binary_copy.rs
  • connect.rs
  • connect_raw.rs
  • conneciton.rs
  • copy_in.rs
  • copy_out.rs
  • query.rs
  • simple_query.rs

I'd expect that a released crate would build so, what might I be doing wrong?

@sfackler
Copy link
Owner

sfackler commented Oct 7, 2022

Both of those imports definitely exist: https://docs.rs/futures-util/latest/src/futures_util/lib.rs.html#300. Are you sure you aren't using a patched version of futures-util?

@gerob311
Copy link
Author

gerob311 commented Oct 7, 2022

Not that I'm aware of. Here's my dependencies list:

[dependencies]
chrono = { version = "0.4.22", features = ["serde"] }
chrono-tz = { version = "0.6.3", features = ["serde"] }
serde = { version = "~1.0", features = ["derive"] }
serde_json = { version = "~1.0.59", features = ["raw_value"] }
log = "~0.4.11"
simple_logger = "~2.3.0"
postgres = "0.19.4"
postgres-types = { version = "0.2.4", features = ["derive"] }
r2d2 = "~0.8.10"
r2d2_postgres = "~0.18.1"
rocket = { version = "0.5.0-rc.2", features = ["json"] }

I've tried commenting out every dependency except postgres = "0.19.4", and running cargo clean then cargo build, and I'm still getting the same problem. I'm not sure what else to try.

In case it helps, I'm using rustc 1.64.0, and I'm using the 2018 rust edition.

Looking at the link you posted, does Stream need to be imported as stream::Stream? That might be naive of me, I'm still not confident with Rust's import usage.

@sfackler
Copy link
Owner

sfackler commented Oct 8, 2022

You could try deleting your Cargo cache to see if the source of the futures_util crate was modified or corrupted locally.

@gerob311
Copy link
Author

gerob311 commented Oct 9, 2022

I have now tried deleting my Cargo cache, and I am getting the same problem, when postgres = "0.19.4 is my only dependency. Does that mean it needs to be fixed on crates.io?

@sfackler
Copy link
Owner

sfackler commented Oct 9, 2022

I cannot reproduce your issue locally. It is highly unlikely that anything needs to be fixed on crates.io.

@palfrey
Copy link
Contributor

palfrey commented Jan 10, 2023

I've just hit this. The problem is that tokio-postgres says it depends on 0.3 of futures-util but in some 0.3.x versions (e.g. 0.3.13) it's not present.

@palfrey
Copy link
Contributor

palfrey commented Jan 10, 2023

Setting the minimum to 0.3.14 seems to fix things though

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

Successfully merging a pull request may close this issue.

3 participants