What this package is like to depend on
Last release 1 months ago
22 Jul 2026
Ships fairly regularly
a new release about every 6 weeks
Rarely documented
notes for 10 of 339 stable releases
17 versions withdrawn
withdrawn after publishing
10 years old
356 releases · first in 2016
17 releases in the last 12 months
see the full history below
Release timeline
356 releases · Sep 2016 to Jul 2026Releases
latest 60 of 356-
3.0.322 Jul 2026 -
3.0.220 Jul 2026Release notes
Open source → -
3.0.119 Jul 2026 -
3.0.018 Jul 2026Release notes
Open source →This release contains adjustments to the syntax tree to account for ongoing Rust language development from the 3 years since syn 2.0.0 and to anticipate some in-flight Rust language RFCs.
These include: default values in fields, pinned type sugar, raw lifetimes, generator blocks and functions, unnamed enum variants, attributes in tuple types and tuple patterns, named arguments in parenthesized generic argument lists, lightweight clones, const traits, const function pointers, mutability restricted fields, supertrait auto implementation, final associated functions, trait implementability restrictions, const blocks in path arguments, item-level const blocks, return type notation, never patterns, function delegation, mutable by-reference bindings, in-place initialization, field projections, explicitly dyn-compatible traits, view types, file-level frontmatter, generic const arguments, guard patterns, lazy type aliases, explicitly safe foreign items, super let, unsafe fields, pattern types, heterogeneous try-blocks, function contracts, async function trait bounds, static closure coroutine syntax, unsafe binder types, move expressions, for-await loops, and postfix keywords.
Breaking changes
Modifiers
To reserve more room for language evolution, there are 10 new non-exhaustive structs in the syntax tree having the following commonality:
-
Name ending in
Modifiers. {BlockModifiers,ClosureModifiers,ConstModifiers,FieldModifiers,FnModifiers,ImplModifiers,LocalModifiers,TraitBoundModifiers,TraitModifiers,TypeModifiers} -
Each implements
Default. The default value is guaranteed to comprise no tokens. -
Non-exhaustive. Can only be instantiated by Syn's parser or by creating and then mutating
▁▁Modifiers::default(). -
Does not implement
Parse. When parsing, they are parsed by the enclosing syntax tree node. -
Does not implement
ToTokens. In some cases the syntax that these nodes might hold in the future is not necessarily contiguous tokens. -
Provides
.require_empty() -> Result<()>which returns a meaningfully spanned error if the modifiers are different from the empty default. This enables a caller to reject syntax it does not recognize without knowing what that syntax may be.
Types
-
Type::BareFnhas been renamed toType::FnPtrto mirror the compiler's terminology. Together with this,BareVariadicis renamed toFnPtrVariadic. -
The mutually exclusive
const_tokenandmutabilityfields ofType::Ptrhave been unified into an enum of typePointerMutability, which was already previously used byExpr::RawAddr. -
Every
Typevariant now holds attributes, which can represent the attributes of element types inside a tuple type, or attributes for a function return type. -
BareFnArgis renamed toNamedArgand is used inParenthesizedGenericArguments, in addition to the existing use inType::FnPtr.
Expressions
- In
Expr::Closure, the fieldsor1_tokenandor2_tokenhave been renamed toinputs_beginandinputs_endto indicate the beginning and ending|token of the closure inputs.
Statements
- Attributes are now preserved on all expression kinds in statement position. Previously, parsing would silently lose attributes on some expression statements without a dedicated Expr variant, such as tail-call expressions.
Patterns
- The
guardfield ofArmis replaced by a newPat::Guardvariant held in the arm'spat.
Items
-
The
unsafetyfield ofSignature, which represented the presence or absence ofunsafe, is replaced by a 3-waySafetyenum which may be safe, unsafe, or default.ForeignItem::Staticalso gets aSafety. -
Some of the fields of
Receiverhave been split to a non-exhaustiveReceiverKindenum to create room for proposed new kinds of method receivers, such as pinned. -
Type aliases now hold a
WhereClausePlacementto distinguish between early placement (which is the default for item-level type aliases and is deprecated in associated type aliases) and late placement (which is the default for associated type aliases and is unstable in item-level type aliases). Parsing and printing a syntax tree will now preserve the where-clause placement rather than rewriting it to the default placement for the item kind.
Generics
-
WherePredicate::LifetimeandWherePredicate::Typehave a new field holding the attributes on the where-predicates. -
GenericParam::TypeandGenericParam::Constnow match the rest of the syntax tree in holding their optional default using a single Option of tuple, rather than a pair of Option.
Literals
-
The
Parseimplementation ofLifetimeno longer permits keyword lifetimes, matching a change in Rust 1.81 to deny such lifetimes pre-expansion.Lifetime::parse_anymay be used to parse lifetimes permissive of keywords. -
LitIntandLitFloatno longer implementFrom<proc_macro2::Literal>. UseLit::new(literal)and then matchLit::IntorLit::Float. -
The
StrStyleenum was unused and has been deleted.
More
-
Filecontains a newOption<Frontmatter>, but does not yet parse frontmatter insyn::parse_fileuntil that language feature progresses closer to stabilization. -
Some enums no longer provide
Fromimpls. Construct the variant by name instead, such asExpr::Array(e)in place ofe.into(). -
The
popmethod ofPunctuated<T, P>now returnsOption<T>discarding the trailing punctuation if any, rather thanOption<Pair<T, P>>. A new methodpop_pairprovides the old behavior. -
Syntax tree traversal (
visit,visit_mut,fold) no longer provides a method for processingSpan. This was already incompletely supported and never walked most of the spans in a syntax tree. -
The
SpeculativeandAnyDelimitertraits have been sealed and cannot be implemented for types outside of Syn'sParseStream.
-
-
2.0.11915 Jul 2026 -
2.0.11816 Jun 2026 -
2.0.11720 Feb 2026 -
2.0.11615 Feb 2026Release notes
Open source →- Optimize parse_fn_arg_or_variadic for less lookahead on erroneous receiver (#1968)
-
2.0.11512 Feb 2026 -
2.0.11407 Jan 2026Release notes
Open source → -
2.0.11303 Jan 2026Nothing published for this version
-
2.0.11230 Dec 2025Nothing published for this version
-
2.0.11123 Nov 2025Nothing published for this version
-
2.0.11010 Nov 2025Nothing published for this version
-
2.0.10905 Nov 2025Nothing published for this version
-
2.0.10822 Oct 2025Nothing published for this version
-
2.0.10718 Oct 2025Nothing published for this version
-
2.0.10616 Aug 2025Nothing published for this version
-
2.0.10513 Aug 2025Nothing published for this version
-
2.0.10420 Jun 2025Nothing published for this version
-
2.0.10313 Jun 2025Nothing published for this version
-
2.0.10210 Jun 2025Nothing published for this version
-
2.0.10126 Apr 2025Nothing published for this version
-
2.0.10009 Mar 2025Nothing published for this version
-
2.0.9903 Mar 2025Nothing published for this version
-
2.0.9802 Feb 2025Nothing published for this version
-
2.0.9701 Feb 2025Nothing published for this version
-
2.0.9610 Jan 2025Nothing published for this version
-
2.0.9505 Jan 2025Nothing published for this version
-
2.0.9401 Jan 2025Nothing published for this version
-
2.0.9328 Dec 2024Nothing published for this version
-
2.0.9226 Dec 2024Nothing published for this version
-
2.0.9122 Dec 2024Nothing published for this version
-
2.0.9029 Nov 2024Nothing published for this version
-
2.0.8921 Nov 2024Nothing published for this version
-
2.0.8821 Nov 2024Nothing published for this version
-
2.0.8702 Nov 2024Nothing published for this version
-
2.0.8631 Oct 2024Nothing published for this version
-
2.0.8523 Oct 2024Nothing published for this version
-
2.0.8423 Oct 2024Nothing published for this version
-
2.0.8323 Oct 2024Nothing published for this version
-
2.0.8220 Oct 2024Nothing published for this version
-
2.0.8120 Oct 2024Nothing published for this version
-
2.0.8019 Oct 2024Nothing published for this version
-
2.0.7927 Sep 2024Nothing published for this version
-
2.0.7827 Sep 2024Nothing published for this version
-
2.0.7731 Aug 2024Nothing published for this version
-
2.0.7624 Aug 2024Nothing published for this version
-
2.0.7517 Aug 2024Nothing published for this version
-
2.0.7411 Aug 2024Nothing published for this version
-
2.0.7311 Aug 2024Nothing published for this version
-
2.0.7221 Jul 2024Nothing published for this version
-
2.0.7112 Jul 2024Nothing published for this version
-
2.0.7008 Jul 2024Nothing published for this version
-
2.0.6906 Jul 2024Nothing published for this version
-
2.0.6823 Jun 2024Nothing published for this version
-
2.0.6720 Jun 2024Nothing published for this version
-
2.0.6623 May 2024Nothing published for this version
-
2.0.6519 May 2024Nothing published for this version
-
2.0.6416 May 2024Nothing published for this version