From 919c9da62bf9f8d39bbc8b4f804f9f85769b9b28 Mon Sep 17 00:00:00 2001 From: Stefan Steiner Date: Mon, 7 Sep 2026 23:38:03 -0700 Subject: [PATCH] =?UTF-8?q?chore(deps):=20upgrade=20syn=202=20=E2=86=92=20?= =?UTF-8?q?3=20in=20hyperdb-api-derive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit syn 3.0 adds an `attrs` field to type-syntax nodes (`TypePath`, etc.), so the exhaustive `TypePath { path, qself: None }` struct patterns no longer compile (E0027). Match `..` to ignore it — we never inspect attributes on a type node. Supersedes Dependabot #314, which bumped the pin but left the source on syn 2's API, failing the clippy and msrv (1.88) gates. syn 3.0.5's own MSRV is 1.71, well under the 1.88 floor. Verified: clippy --workspace --all-targets --all-features -D warnings, msrv 1.88 workspace + standalone compile-check checks, fmt, the derive crate's trybuild UI suite (compile-fail stderr snapshots unchanged under syn 3), the compile-check validator tests, the doc gate, and the compile_time_validation example end-to-end — all green. --- Cargo.lock | 2 +- hyperdb-api-derive/Cargo.toml | 2 +- hyperdb-api-derive/src/lib.rs | 10 ++++++++-- hyperdb-api-derive/src/table_derive.rs | 17 +++++++++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07871b5f..03a79ea9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1850,7 +1850,7 @@ dependencies = [ "hyperdb-compile-check", "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.5", "trybuild", ] diff --git a/hyperdb-api-derive/Cargo.toml b/hyperdb-api-derive/Cargo.toml index a01c6f4d..626e2f3b 100644 --- a/hyperdb-api-derive/Cargo.toml +++ b/hyperdb-api-derive/Cargo.toml @@ -23,7 +23,7 @@ proc-macro = true compile-time = ["dep:hyperdb-compile-check"] [dependencies] -syn = { version = "2", features = ["full"] } +syn = { version = "3", features = ["full"] } quote = "1" proc-macro2 = "1" # x-release-please-start-version diff --git a/hyperdb-api-derive/src/lib.rs b/hyperdb-api-derive/src/lib.rs index de82d583..a93acf41 100644 --- a/hyperdb-api-derive/src/lib.rs +++ b/hyperdb-api-derive/src/lib.rs @@ -187,7 +187,10 @@ fn expand_query_as(input: &TokenStream2) -> syn::Result { /// Only needed when `compile-time` feature is enabled (used for registry lookup). #[cfg(feature = "compile-time")] fn last_type_ident(ty: &Type) -> Option<&syn::Ident> { - let Type::Path(syn::TypePath { path, qself: None }) = ty else { + let Type::Path(syn::TypePath { + path, qself: None, .. + }) = ty + else { return None; }; path.segments.last().map(|s| &s.ident) @@ -397,7 +400,10 @@ fn field_source_for(field: &Field, default: &syn::Ident) -> syn::Result` (any path ending in `Option`). fn is_option_type(ty: &Type) -> bool { - let Type::Path(TypePath { path, qself: None }) = ty else { + let Type::Path(TypePath { + path, qself: None, .. + }) = ty + else { return false; }; let Some(last) = path.segments.last() else { diff --git a/hyperdb-api-derive/src/table_derive.rs b/hyperdb-api-derive/src/table_derive.rs index 4df68522..5e4e8bfd 100644 --- a/hyperdb-api-derive/src/table_derive.rs +++ b/hyperdb-api-derive/src/table_derive.rs @@ -302,7 +302,10 @@ fn rust_type_to_sql<'a>(field: &Field, ty: &'a Type) -> syn::Result<&'a str> { /// If `ty` is `Option`, return `(T, true)`. Otherwise return `(ty, false)`. fn unwrap_option(ty: &Type) -> (&Type, bool) { - let Type::Path(TypePath { path, qself: None }) = ty else { + let Type::Path(TypePath { + path, qself: None, .. + }) = ty + else { return (ty, false); }; let Some(last) = path.segments.last() else { @@ -323,7 +326,10 @@ fn unwrap_option(ty: &Type) -> (&Type, bool) { /// Returns `true` if `ty` is exactly `Vec` (the only `Vec<_>` that maps to BYTES). fn is_vec_u8(ty: &Type) -> bool { - let Type::Path(TypePath { path, qself: None }) = ty else { + let Type::Path(TypePath { + path, qself: None, .. + }) = ty + else { return false; }; let Some(last) = path.segments.last() else { @@ -337,14 +343,17 @@ fn is_vec_u8(ty: &Type) -> bool { }; matches!( args.args.first(), - Some(GenericArgument::Type(Type::Path(TypePath { path, qself: None }))) + Some(GenericArgument::Type(Type::Path(TypePath { path, qself: None, .. }))) if path.is_ident("u8") ) } /// Extract the last path segment ident from a type, if it's a simple `TypePath`. fn last_path_ident(ty: &Type) -> Option<&syn::Ident> { - let Type::Path(TypePath { path, qself: None }) = ty else { + let Type::Path(TypePath { + path, qself: None, .. + }) = ty + else { return None; }; path.segments.last().map(|s| &s.ident)