From 39453acff26b34701efbea53bc0cc5eab9c93a97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jul 2026 10:32:53 +0000 Subject: [PATCH 1/2] Bump syn from 2.0.118 to 3.0.2 Bumps [syn](https://github.com/dtolnay/syn) from 2.0.118 to 3.0.2. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.118...3.0.2) --- updated-dependencies: - dependency-name: syn dependency-version: 3.0.2 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Cargo.lock | 14 +++++++------- thrust-macros/Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0e66741..0e7a5713 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -591,7 +591,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -660,9 +660,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.118" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" dependencies = [ "proc-macro2", "quote", @@ -728,7 +728,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -773,7 +773,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.2", ] [[package]] @@ -795,7 +795,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -950,7 +950,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", "wasm-bindgen-shared", ] diff --git a/thrust-macros/Cargo.toml b/thrust-macros/Cargo.toml index a0898642..7f7fe0b3 100644 --- a/thrust-macros/Cargo.toml +++ b/thrust-macros/Cargo.toml @@ -10,4 +10,4 @@ proc-macro = true [dependencies] proc-macro2 = "1" quote = "1" -syn = { version = "2", features = ["extra-traits", "full", "visit", "visit-mut"] } +syn = { version = "3", features = ["extra-traits", "full", "visit", "visit-mut"] } From 4e5d69cce5605e1e32c7be666cc21bfc00dcc9bb Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Jul 2026 11:16:50 +0000 Subject: [PATCH 2/2] Fix thrust-macros build against syn 3.0 syn 3.0 restructures method receivers: Receiver::ty is replaced by a ReceiverKind enum (Value/Reference/Typed), and Punctuated::pop() now returns the element directly instead of a Pair, so Pair::into_value() no longer applies. Add a receiver_type() helper that reconstructs the effective self type (mirroring syn 2's Receiver::ty) and use it at both call sites, and drop the now-unnecessary into_value() calls in spec.rs. --- thrust-macros/src/formula_fn_type_lowering.rs | 2 +- thrust-macros/src/invariant.rs | 2 +- thrust-macros/src/lib.rs | 20 +++++++++++++++++++ thrust-macros/src/spec.rs | 8 ++++---- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/thrust-macros/src/formula_fn_type_lowering.rs b/thrust-macros/src/formula_fn_type_lowering.rs index faac646b..4c992ab6 100644 --- a/thrust-macros/src/formula_fn_type_lowering.rs +++ b/thrust-macros/src/formula_fn_type_lowering.rs @@ -49,7 +49,7 @@ impl<'a> FormulaFnTypeLowering<'a> { for arg in args { match arg { syn::FnArg::Receiver(receiver) => { - let ty = &receiver.ty; + let ty = crate::receiver_type(receiver); model_inputs.push(syn::parse_quote!(self_: <#ty as thrust_models::Model>::Ty)); } syn::FnArg::Typed(pt) => { diff --git a/thrust-macros/src/invariant.rs b/thrust-macros/src/invariant.rs index 8c732973..f94f3db2 100644 --- a/thrust-macros/src/invariant.rs +++ b/thrust-macros/src/invariant.rs @@ -300,7 +300,7 @@ impl VisitMut for SelfValueRewriter { match arg { syn::FnArg::Receiver(receiver) => { let to = &self.to; - let ty = &receiver.ty; + let ty = crate::receiver_type(receiver); *arg = syn::parse_quote!(#to: #ty); } syn::FnArg::Typed(_) => { /* handled by visit_pat_ident_mut */ } diff --git a/thrust-macros/src/lib.rs b/thrust-macros/src/lib.rs index 2c89f573..429be63a 100644 --- a/thrust-macros/src/lib.rs +++ b/thrust-macros/src/lib.rs @@ -133,6 +133,26 @@ pub fn sig(attr: TokenStream, item: TokenStream) -> TokenStream { rty::expand_sig(attr, item) } +/// Reconstructs the effective type of a method receiver (`&self` -> `&Self`, +/// `&mut self` -> `&mut Self`, `self` -> `Self`, `self: T` -> `T`), mirroring +/// what syn 2's `Receiver::ty` used to provide directly. +fn receiver_type(receiver: &syn::Receiver) -> syn::Type { + match &receiver.kind { + syn::ReceiverKind::Typed(_, ty) => (**ty).clone(), + syn::ReceiverKind::Reference(and_token, lifetime, mutability) => { + syn::Type::Reference(syn::TypeReference { + attrs: Vec::new(), + and_token: *and_token, + lifetime: lifetime.clone(), + mutability: *mutability, + elem: Box::new(syn::parse_quote!(Self)), + }) + } + syn::ReceiverKind::Value => syn::parse_quote!(Self), + _ => unimplemented!("unknown syn::ReceiverKind variant"), + } +} + fn tokens_contain_ident(tokens: &TokenStream2, target: T) -> bool where T: AsRef, diff --git a/thrust-macros/src/spec.rs b/thrust-macros/src/spec.rs index ccfbc49e..1def3de3 100644 --- a/thrust-macros/src/spec.rs +++ b/thrust-macros/src/spec.rs @@ -99,8 +99,8 @@ pub fn expand_requires_ensures(attr: TokenStream, item: TokenStream) -> TokenStr .into(); } - let ens_expr = exprs.pop().unwrap().into_value(); - let req_expr = exprs.pop().unwrap().into_value(); + let ens_expr = exprs.pop().unwrap(); + let req_expr = exprs.pop().unwrap(); let func = parse_macro_input!(item as FnItemWithSignature); let outer_context = match extract_outer_context(&func) { @@ -225,8 +225,8 @@ fn extract_requires_ensures(func: &mut FnItemWithSignature) -> syn::Result<(syn: "expected exactly two comma-separated expressions in _requires_ensures attribute", )); } - let ens_expr = exprs.pop().unwrap().into_value(); - let req_expr = exprs.pop().unwrap().into_value(); + let ens_expr = exprs.pop().unwrap(); + let req_expr = exprs.pop().unwrap(); result = Some((req_expr, ens_expr)); } }