From c7efc2cd45cb69633bdbb3190999478121c5d965 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 11:23:07 +0000 Subject: [PATCH 1/2] Bump syn from 2.0.118 to 3.0.3 in /autorust Bumps [syn](https://github.com/dtolnay/syn) from 2.0.118 to 3.0.3. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.118...3.0.3) --- updated-dependencies: - dependency-name: syn dependency-version: 3.0.3 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- autorust/Cargo.lock | 2 +- autorust/codegen/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autorust/Cargo.lock b/autorust/Cargo.lock index d4daad03..3fb109f4 100644 --- a/autorust/Cargo.lock +++ b/autorust/Cargo.lock @@ -355,7 +355,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "syn 2.0.118", + "syn 3.0.3", "thiserror 2.0.20", "toml", ] diff --git a/autorust/codegen/Cargo.toml b/autorust/codegen/Cargo.toml index 17798b63..fe841f08 100644 --- a/autorust/codegen/Cargo.toml +++ b/autorust/codegen/Cargo.toml @@ -21,7 +21,7 @@ comrak = "0.54" serde = "1" http-types = "2" once_cell = "1" -syn = { version = "2", features = ["parsing"] } +syn = { version = "3", features = ["parsing"] } camino = "1" askama = "0.16" toml = "1.1" From f7211dd83c21fe56f32f2e9f7191e3f79b8e20be Mon Sep 17 00:00:00 2001 From: John Batty Date: Mon, 10 Aug 2026 15:32:22 +0100 Subject: [PATCH 2/2] Migrate autorust codegen to syn 3.0 API Adapt codegen.rs to syn 3.0 breaking changes so the generator compiles with syn 3: TraitBoundModifier enum replaced by TraitBoundModifiers struct plus a separate `maybe` field, mandatory `attrs` on Type variants, and removal of the From<...> for Type impls (use explicit variants). Generated crate output is byte-identical. Co-Authored-By: Claude Opus 4.8 (1M context) --- autorust/codegen/src/codegen.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/autorust/codegen/src/codegen.rs b/autorust/codegen/src/codegen.rs index ee13b0a7..742728e5 100644 --- a/autorust/codegen/src/codegen.rs +++ b/autorust/codegen/src/codegen.rs @@ -16,7 +16,7 @@ use syn::{ punctuated::Punctuated, token::{Gt, Impl, Lt}, AngleBracketedGenericArguments, GenericArgument, Path, PathArguments, PathSegment, TraitBound, - TraitBoundModifier, Type, TypeImplTrait, TypeParamBound, TypePath, TypeReference, + TraitBoundModifiers, Type, TypeImplTrait, TypeParamBound, TypePath, TypeReference, }; /// code generation context @@ -299,21 +299,22 @@ impl TypeNameCode { if self.allow_qualify_models && self.qualify_models { tp.path.segments.insert(0, id_models().into()); } - let mut tp = Type::from(tp); + let mut tp = Type::Path(tp); for _ in 0..self.vec_count { tp = generic_type(tp_vec(), tp); } if self.force_value { - tp = Type::from(tp_json_value()) + tp = Type::Path(tp_json_value()) } if self.is_reference() { let tr = TypeReference { + attrs: Vec::new(), and_token: Default::default(), lifetime: Default::default(), mutability: Default::default(), elem: Box::new(tp), }; - tp = Type::from(tr); + tp = Type::Reference(tr); } if self.boxed { tp = generic_type(tp_box(), tp); @@ -327,13 +328,15 @@ impl TypeNameCode { let bound = TraitBound { path: path.path, paren_token: None, - modifier: TraitBoundModifier::None, + modifiers: TraitBoundModifiers::default(), + maybe: None, lifetimes: None, }; let bound = TypeParamBound::Trait(bound); let mut bounds = Punctuated::new(); bounds.push(bound); tp = Type::ImplTrait(TypeImplTrait { + attrs: Vec::new(), bounds, impl_token: Impl::default(), }); @@ -378,7 +381,7 @@ fn generic_type(mut wrap_tp: TypePath, tp: Type) -> Type { if let Some(v) = wrap_tp.path.segments.last_mut() { v.arguments = arguments } - Type::from(wrap_tp) + Type::Path(wrap_tp) } impl From for TypeNameCode { @@ -434,7 +437,11 @@ fn segments_to_type_path(segments: Vec) -> TypePath { segments: punctuated, leading_colon: None, }; - TypePath { path, qself: None } + TypePath { + attrs: Vec::new(), + path, + qself: None, + } } fn idents_to_type_path(idents: Vec) -> TypePath {