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

Use of re-exported sqlx causes macros to throw extensive errors #1044

Open
utopiabound opened this issue Feb 11, 2021 · 2 comments
Open

Use of re-exported sqlx causes macros to throw extensive errors #1044

utopiabound opened this issue Feb 11, 2021 · 2 comments

Comments

@utopiabound
Copy link

From one package in a project:
project/sub-postgres/src/lib.rs

pub use sqlx::{self, postgres::PgPool};
...

project/sub-usepsql/src/lib.rs

use sub_postgres::sqlx::{self, PgPool};
...
let foo = query!(...)

With sqlx 0.4 this worked just fine.
WIth sqlx 0.5 (because of 76326c6) This throws extensive errors if sqlx isn't also included in project/sub-usepsql/Cargo.toml

@jplatte
Copy link
Contributor

jplatte commented Feb 11, 2021

That this worked on 0.4 was not intentional. Generally proc-macros are expected to work regardless of other items in the crate or module, and if the macros looked for sqlx (0.4 behaviour) instead of ::sqlx (0.5 behaviour), they would break if there was a local module named sqlx that doesn't re-export a bunch of stuff from the sqlx crate.

@jplatte
Copy link
Contributor

jplatte commented Feb 11, 2021

If you are annoyed by having to re-specify the version and features for your dependencies in multiple crates of your workspace, I suggest watching rust-lang/cargo#8415.

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