diff --git a/postgres-macros/Cargo.toml b/postgres-macros/Cargo.toml index a9ceabf..c7ec591 100644 --- a/postgres-macros/Cargo.toml +++ b/postgres-macros/Cargo.toml @@ -21,11 +21,11 @@ pgvector = { version = "0.3", features = ["postgres"], optional = true } postgres = "0.19" proc-macro2 = { version = "1.0", features = ["span-locations"] } quote = "1.0" -rustls = { version = "0.22" } +rustls = { version = "0.23" } serde_json = { version = "1.0", optional = true } syn = { version = "2.0", features = ["full", "extra-traits"] } time = { version = "0.3", optional = true } -tokio-postgres-rustls = "0.11" +tokio-postgres-rustls = "0.12" uuid = { version = "1.4", optional = true } [dev-dependencies] diff --git a/postgres-macros/build.rs b/postgres-macros/build.rs index d5306f2..78e5083 100644 --- a/postgres-macros/build.rs +++ b/postgres-macros/build.rs @@ -1,6 +1,7 @@ #[rustversion::nightly] fn main() { println!("cargo:rustc-cfg=nightly_column_names"); + println!("cargo::rustc-check-cfg=cfg(nightly_column_names)"); } #[rustversion::not(nightly)] diff --git a/postgres-macros/src/sql.rs b/postgres-macros/src/sql.rs index 63b6806..1daab26 100644 --- a/postgres-macros/src/sql.rs +++ b/postgres-macros/src/sql.rs @@ -519,13 +519,16 @@ impl Parse for Input { #[derive(Debug)] struct NoServerCertVerify { - crypto_provider: rustls::crypto::CryptoProvider, + crypto_provider: Arc, } impl Default for NoServerCertVerify { fn default() -> Self { Self { - crypto_provider: rustls::crypto::ring::default_provider(), + crypto_provider: Arc::clone( + rustls::crypto::CryptoProvider::get_default() + .expect("no default provider for rustls installed"), + ), } } } @@ -571,7 +574,7 @@ impl rustls::client::danger::ServerCertVerifier for NoServerCertVerify { } fn supported_verify_schemes(&self) -> Vec { - rustls::crypto::ring::default_provider() + self.crypto_provider .signature_verification_algorithms .supported_schemes() } diff --git a/postgres-macros/tests/fail-nightly/enum_extra_variant.stderr b/postgres-macros/tests/fail-nightly/enum_extra_variant.stderr index 1db41a3..39740db 100644 --- a/postgres-macros/tests/fail-nightly/enum_extra_variant.stderr +++ b/postgres-macros/tests/fail-nightly/enum_extra_variant.stderr @@ -14,6 +14,4 @@ error[E0277]: the trait bound `Vec: Query, > as Query>> > as Query>>> as Query>> - = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, ...)>, "role">)>, ...>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-4ffcc67694e213f1.long-type-11745197285905521998.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, EnumVariant<"user">)>, "role">)>, Vec>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail-nightly/enum_missing_variant.stderr b/postgres-macros/tests/fail-nightly/enum_missing_variant.stderr index 012916a..d54a2bf 100644 --- a/postgres-macros/tests/fail-nightly/enum_missing_variant.stderr +++ b/postgres-macros/tests/fail-nightly/enum_missing_variant.stderr @@ -14,6 +14,4 @@ error[E0277]: the trait bound `Vec: Query, > as Query>> > as Query>>> as Query>> - = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, ...)>, "role">)>, ...>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-6f9d778168733bb2.long-type-11135974624108269593.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, EnumVariant<"user">)>, "role">)>, Vec>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail-nightly/enum_variant_mismatch.stderr b/postgres-macros/tests/fail-nightly/enum_variant_mismatch.stderr index 1b64f18..817c4a1 100644 --- a/postgres-macros/tests/fail-nightly/enum_variant_mismatch.stderr +++ b/postgres-macros/tests/fail-nightly/enum_variant_mismatch.stderr @@ -14,6 +14,4 @@ error[E0277]: the trait bound `Vec: Query, > as Query>> > as Query>>> as Query>> - = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, ...)>, "role">)>, ...>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-108a3d1f17e7e28e.long-type-6590895828837905940.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, EnumVariant<"user">)>, "role">)>, Vec>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail-stable/enum_array_to_enum_literal.stderr b/postgres-macros/tests/fail-stable/enum_array_to_enum_literal.stderr index c303b68..7c78aaf 100644 --- a/postgres-macros/tests/fail-stable/enum_array_to_enum_literal.stderr +++ b/postgres-macros/tests/fail-stable/enum_array_to_enum_literal.stderr @@ -17,6 +17,4 @@ error[E0277]: the trait bound `Role: Query> as Query>> as Query>> and $N others - = note: required for `Sql<'_, Array, EnumVariant<10465144470622129318>)>>>, Role>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-4bc7215b1b514162.long-type-14335032845333733167.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, sqlm_postgres::types::Array, EnumVariant<10465144470622129318>)>>>, Role>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail-stable/enum_extra_variant.stderr b/postgres-macros/tests/fail-stable/enum_extra_variant.stderr index a857d67..edd8d5a 100644 --- a/postgres-macros/tests/fail-stable/enum_extra_variant.stderr +++ b/postgres-macros/tests/fail-stable/enum_extra_variant.stderr @@ -14,6 +14,4 @@ error[E0277]: the trait bound `Vec: Query as Query>> as Query::Type>>> as Query::Type>>>> - = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, 18137070463969723500>)>, ...>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-b0dd2e997e73b906.long-type-10761428105402107117.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, EnumVariant<10465144470622129318>)>, 18137070463969723500>)>, Vec>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail-stable/enum_missing_variant.stderr b/postgres-macros/tests/fail-stable/enum_missing_variant.stderr index 50e230b..9a9afb5 100644 --- a/postgres-macros/tests/fail-stable/enum_missing_variant.stderr +++ b/postgres-macros/tests/fail-stable/enum_missing_variant.stderr @@ -14,6 +14,4 @@ error[E0277]: the trait bound `Vec: Query as Query>> as Query::Type>>> as Query::Type>>>> - = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, 18137070463969723500>)>, ...>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-23861a9b6cd68f51.long-type-6152349442456453118.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, EnumVariant<10465144470622129318>)>, 18137070463969723500>)>, Vec>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail-stable/enum_variant_mismatch.stderr b/postgres-macros/tests/fail-stable/enum_variant_mismatch.stderr index 9f3b2b4..a162ca8 100644 --- a/postgres-macros/tests/fail-stable/enum_variant_mismatch.stderr +++ b/postgres-macros/tests/fail-stable/enum_variant_mismatch.stderr @@ -14,6 +14,4 @@ error[E0277]: the trait bound `Vec: Query as Query>> as Query::Type>>> as Query::Type>>>> - = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, 18137070463969723500>)>, ...>` to implement `IntoFuture` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-07e210c716d12d34.long-type-3071872696375387707.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `Sql<'_, Struct<(StructColumn, StructColumn, EnumVariant<10465144470622129318>)>, 18137070463969723500>)>, Vec>` to implement `IntoFuture` diff --git a/postgres-macros/tests/fail/literal_array_to_literal.stderr b/postgres-macros/tests/fail/literal_array_to_literal.stderr index c92b064..1f411cd 100644 --- a/postgres-macros/tests/fail/literal_array_to_literal.stderr +++ b/postgres-macros/tests/fail/literal_array_to_literal.stderr @@ -8,13 +8,13 @@ error[E0277]: the trait bound `String: Query`: - as Query>> - > as Query>> - > as Query>>> - as Query>> + <() as Query<()>> + as Query::Type>>> + as Query>> + > as Query>> as Query::Type>>> + as Query>> as Query::Type>>>> - > as Query>> - as Query>> + > as Query>> and $N others = note: required for `Sql<'_, sqlm_postgres::types::Array>, String>` to implement `IntoFuture` diff --git a/postgres/Cargo.toml b/postgres/Cargo.toml index bce883e..c7c39ee 100644 --- a/postgres/Cargo.toml +++ b/postgres/Cargo.toml @@ -15,19 +15,19 @@ uuid = ["sqlm-postgres-macros/uuid", "tokio-postgres/with-uuid-1", "dep:uuid"] pgvector = ["sqlm-postgres-macros/pgvector", "dep:pgvector"] [dependencies] -deadpool-postgres = "0.12" +deadpool-postgres = "0.13" dotenvy = "0.15" http-error = { version = "0.3.0-alpha.1", features = [ "tracing", ] } # git = "https://github.com/rkusa/http-error.git", rev = "1f0630c" } # path = "../../http-error" } once_cell = "1.17" pgvector = { version = "0.3", features = ["postgres"], optional = true } -rustls = { version = "0.22" } +rustls = { version = "0.23" } serde_json = { version = "1.0", optional = true } sqlm-postgres-macros = { path = "../postgres-macros", default-features = false } time = { version = "0.3", optional = true } tokio-postgres = "0.7" -tokio-postgres-rustls = "0.11" +tokio-postgres-rustls = "0.12" tracing = "0.1" uuid = { version = "1.4", optional = true } diff --git a/postgres/build.rs b/postgres/build.rs index d5306f2..78e5083 100644 --- a/postgres/build.rs +++ b/postgres/build.rs @@ -1,6 +1,7 @@ #[rustversion::nightly] fn main() { println!("cargo:rustc-cfg=nightly_column_names"); + println!("cargo::rustc-check-cfg=cfg(nightly_column_names)"); } #[rustversion::not(nightly)] diff --git a/postgres/src/lib.rs b/postgres/src/lib.rs index ce2b192..b6b6c26 100644 --- a/postgres/src/lib.rs +++ b/postgres/src/lib.rs @@ -27,7 +27,6 @@ pub use future::SqlFuture; use once_cell::sync::OnceCell; pub use query::Query; pub use row::{FromRow, Row}; -use rustls::crypto::CryptoProvider; pub use sqlm_postgres_macros::{sql, Enum, FromRow}; pub use tokio_postgres; use tokio_postgres::config::SslMode; @@ -101,13 +100,16 @@ impl<'a, Cols, T> Sql<'a, Cols, T> { #[derive(Debug)] struct NoServerCertVerify { - crypto_provider: CryptoProvider, + crypto_provider: Arc, } impl Default for NoServerCertVerify { fn default() -> Self { Self { - crypto_provider: rustls::crypto::ring::default_provider(), + crypto_provider: Arc::clone( + rustls::crypto::CryptoProvider::get_default() + .expect("no default provider for rustls installed"), + ), } } } @@ -153,7 +155,7 @@ impl rustls::client::danger::ServerCertVerifier for NoServerCertVerify { } fn supported_verify_schemes(&self) -> Vec { - rustls::crypto::ring::default_provider() + self.crypto_provider .signature_verification_algorithms .supported_schemes() }