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

Depends on all database crates regardless of features #2686

Closed
stepantubanov opened this issue Aug 7, 2023 · 2 comments
Closed

Depends on all database crates regardless of features #2686

stepantubanov opened this issue Aug 7, 2023 · 2 comments
Labels

Comments

@stepantubanov
Copy link
Contributor

Bug Description

Installs sqlx-sqlite and sqlx-postgres even when only mysql feature is selected.

Minimal Reproduction

Cargo.toml file:

[package]
name = "example-sqlx"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "mysql"] }

Execute cargo check. Contents of Cargo.lock:

...

[[package]]
name = "libsqlite3-sys"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326"
dependencies = [
 "cc",
 "pkg-config",
 "vcpkg",
]

...

[[package]]
name = "sqlx"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721"
dependencies = [
 "sqlx-core",
 "sqlx-macros",
 "sqlx-mysql",
 "sqlx-postgres",
 "sqlx-sqlite",
]

...

Info

  • SQLx version: 0.7.1
  • SQLx features enabled: ["runtime-tokio-rustls", "mysql"]
  • Database server and version: not applicable
  • Operating system: macOS
  • rustc --version: rustc 1.71.0 (8ede3aae2 2023-07-12)
@kyrias
Copy link

kyrias commented Aug 7, 2023

Bug Description

Installs sqlx-sqlite and sqlx-postgres even when only mysql feature is selected.

This is incorrect. Cargo builds lockfiles assuming all features are enabled. That does not mean that those dependencies are actually built.

@stepantubanov
Copy link
Contributor Author

@kyrias
Thanks! Found this issue: rust-lang/cargo#10801

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

No branches or pull requests

2 participants