PackageTrack
Sign in Get early access

syn

Parser for Rust source code

3.0.3 2.2B downloads/mo #2 most downloaded on crates.io dtolnay/syn

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 2026
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 60 of 356
  1. 3.0.3 22 Jul 2026
    Release notes
    • Documentation improvements
    Open source →
    Release notes

    3.0.3 Latest

    Latest

    Compare

    Choose a tag to compare

    Open source →
  2. 3.0.2 20 Jul 2026
    Release notes Open source →
    Release notes

    3.0.2

    Compare

    Choose a tag to compare

    Open source →
  3. 3.0.1 19 Jul 2026
    Release notes
    Open source →
    Release notes

    3.0.1

    Compare

    Choose a tag to compare

    Open source →
  4. 3.0.0 18 Jul 2026
    Release notes

    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.


    [API documentation for 3.0]

    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::BareFn has been renamed to Type::FnPtr to mirror the compiler's terminology. Together with this, BareVariadic is renamed to FnPtrVariadic.

    • The mutually exclusive const_token and mutability fields of Type::Ptr have been unified into an enum of type PointerMutability, which was already previously used by Expr::RawAddr.

    • Every Type variant now holds attributes, which can represent the attributes of element types inside a tuple type, or attributes for a function return type.

    • BareFnArg is renamed to NamedArg and is used in ParenthesizedGenericArguments, in addition to the existing use in Type::FnPtr.

    Expressions

    • In Expr::Closure, the fields or1_token and or2_token have been renamed to inputs_begin and inputs_end to 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 guard field of Arm is replaced by a new Pat::Guard variant held in the arm's pat.

    Items

    • The unsafety field of Signature, which represented the presence or absence of unsafe, is replaced by a 3-way Safety enum which may be safe, unsafe, or default. ForeignItem::Static also gets a Safety.

    • Some of the fields of Receiver have been split to a non-exhaustive ReceiverKind enum to create room for proposed new kinds of method receivers, such as pinned.

    • Type aliases now hold a WhereClausePlacement to 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::Lifetime and WherePredicate::Type have a new field holding the attributes on the where-predicates.

    • GenericParam::Type and GenericParam::Const now 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 Parse implementation of Lifetime no longer permits keyword lifetimes, matching a change in Rust 1.81 to deny such lifetimes pre-expansion. Lifetime::parse_any may be used to parse lifetimes permissive of keywords.

    • LitInt and LitFloat no longer implement From<proc_macro2::Literal>. Use Lit::new(literal) and then match Lit::Int or Lit::Float.

    • The StrStyle enum was unused and has been deleted.

    More

    • File contains a new Option<Frontmatter>, but does not yet parse frontmatter in syn::parse_file until that language feature progresses closer to stabilization.

    • Some enums no longer provide From impls. Construct the variant by name instead, such as Expr::Array(e) in place of e.into().

    • The pop method of Punctuated<T, P> now returns Option<T> discarding the trailing punctuation if any, rather than Option<Pair<T, P>>. A new method pop_pair provides the old behavior.

    • Syntax tree traversal (visit, visit_mut, fold) no longer provides a method for processing Span. This was already incompletely supported and never walked most of the spans in a syntax tree.

    • The Speculative and AnyDelimiter traits have been sealed and cannot be implemented for types outside of Syn's ParseStream.

    Open source →
    Release notes

    3.0.0

    Compare

    Choose a tag to compare

    Open source →
  5. 2.0.119 15 Jul 2026
    Release notes
    • Preserve attributes on tail-call expressions in statement position (#1994)
    • Parse field-representing types builtin in type position (#1996)
    Open source →
    Release notes

    2.0.119

    Compare

    Choose a tag to compare

    Open source →
  6. 2.0.118 16 Jun 2026
    Release notes
    • Documentation improvements
    Open source →
    Release notes

    2.0.118

    Compare

    Choose a tag to compare

    Open source →
  7. 2.0.117 20 Feb 2026
    Release notes
    • Fix parsing of self:: pattern in first function argument (#1970)
    Open source →
    Release notes

    2.0.117

    Compare

    Choose a tag to compare

    Open source →
  8. 2.0.116 15 Feb 2026
    Release notes
    • Optimize parse_fn_arg_or_variadic for less lookahead on erroneous receiver (#1968)
    Open source →
    Release notes

    2.0.116

    Compare

    Choose a tag to compare

    Open source →
  9. 2.0.115 12 Feb 2026
    Release notes
    • Enable GenericArgument::Constraint parsing in non-full mode (#1966)
    Open source →
    Release notes

    2.0.115

    Compare

    Choose a tag to compare

    Open source →
  10. 2.0.114 07 Jan 2026
    Release notes
    • Make std dependencies more easily discoverable in source code (#1956, thanks @tamird)
    Open source →
    Release notes

    2.0.114

    Compare

    Choose a tag to compare

    Open source →
  11. 2.0.113 03 Jan 2026

    Nothing published for this version

  12. 2.0.112 30 Dec 2025

    Nothing published for this version

  13. 2.0.111 23 Nov 2025

    Nothing published for this version

  14. 2.0.110 10 Nov 2025

    Nothing published for this version

  15. 2.0.109 05 Nov 2025

    Nothing published for this version

  16. 2.0.108 22 Oct 2025

    Nothing published for this version

  17. 2.0.107 18 Oct 2025

    Nothing published for this version

  18. 2.0.106 16 Aug 2025

    Nothing published for this version

  19. 2.0.105 13 Aug 2025

    Nothing published for this version

  20. 2.0.104 20 Jun 2025

    Nothing published for this version

  21. 2.0.103 13 Jun 2025

    Nothing published for this version

  22. 2.0.102 10 Jun 2025

    Nothing published for this version

  23. 2.0.101 26 Apr 2025

    Nothing published for this version

  24. 2.0.100 09 Mar 2025

    Nothing published for this version

  25. 2.0.99 03 Mar 2025

    Nothing published for this version

  26. 2.0.98 02 Feb 2025

    Nothing published for this version

  27. 2.0.97 01 Feb 2025

    Nothing published for this version

  28. 2.0.96 10 Jan 2025

    Nothing published for this version

  29. 2.0.95 05 Jan 2025

    Nothing published for this version

  30. 2.0.94 01 Jan 2025

    Nothing published for this version

  31. 2.0.93 28 Dec 2024

    Nothing published for this version

  32. 2.0.92 26 Dec 2024

    Nothing published for this version

  33. 2.0.91 22 Dec 2024

    Nothing published for this version

  34. 2.0.90 29 Nov 2024

    Nothing published for this version

  35. 2.0.89 21 Nov 2024

    Nothing published for this version

  36. 2.0.88 21 Nov 2024

    Nothing published for this version

  37. 2.0.87 02 Nov 2024

    Nothing published for this version

  38. 2.0.86 31 Oct 2024

    Nothing published for this version

  39. 2.0.85 23 Oct 2024

    Nothing published for this version

  40. 2.0.84 23 Oct 2024

    Nothing published for this version

  41. 2.0.83 23 Oct 2024

    Nothing published for this version

  42. 2.0.82 20 Oct 2024

    Nothing published for this version

  43. 2.0.81 20 Oct 2024

    Nothing published for this version

  44. 2.0.80 19 Oct 2024

    Nothing published for this version

  45. 2.0.79 27 Sep 2024

    Nothing published for this version

  46. 2.0.78 27 Sep 2024

    Nothing published for this version

  47. 2.0.77 31 Aug 2024

    Nothing published for this version

  48. 2.0.76 24 Aug 2024

    Nothing published for this version

  49. 2.0.75 17 Aug 2024

    Nothing published for this version

  50. 2.0.74 11 Aug 2024

    Nothing published for this version

  51. 2.0.73 11 Aug 2024

    Nothing published for this version

  52. 2.0.72 21 Jul 2024

    Nothing published for this version

  53. 2.0.71 12 Jul 2024

    Nothing published for this version

  54. 2.0.70 08 Jul 2024

    Nothing published for this version

  55. 2.0.69 06 Jul 2024

    Nothing published for this version

  56. 2.0.68 23 Jun 2024

    Nothing published for this version

  57. 2.0.67 20 Jun 2024

    Nothing published for this version

  58. 2.0.66 23 May 2024

    Nothing published for this version

  59. 2.0.65 19 May 2024

    Nothing published for this version

  60. 2.0.64 16 May 2024

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive