dtolnay/syn
### [`v2.0.13`](https://togithub.com/dtolnay/syn/releases/tag/2.0.13)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.12...2.0.13)
- Improve spans of Expr::Field parsed from a float Literal ([#1433](https://togithub.com/dtolnay/syn/issues/1433), [#1436](https://togithub.com/dtolnay/syn/issues/1436))
### [`v2.0.12`](https://togithub.com/dtolnay/syn/releases/tag/2.0.12)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.11...2.0.12)
- Refer to `compile_error!` by absolute path in token stream produced by syn::Error::to_compile_error ([#1431](https://togithub.com/dtolnay/syn/issues/1431), thanks [@smoelius](https://togithub.com/smoelius))
### [`v2.0.11`](https://togithub.com/dtolnay/syn/releases/tag/2.0.11)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.10...2.0.11)
- Improve error message on empty parens inside parse_nested_meta ([#1428](https://togithub.com/dtolnay/syn/issues/1428))
### [`v2.0.10`](https://togithub.com/dtolnay/syn/releases/tag/2.0.10)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.9...2.0.10)
- Fix visibility being parsed incorrectly on macro invocations inside of a trait
### [`v2.0.9`](https://togithub.com/dtolnay/syn/releases/tag/2.0.9)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.8...2.0.9)
- Disallow `type` items in an extern block, trait, or module from being marked `default`
### [`v2.0.8`](https://togithub.com/dtolnay/syn/releases/tag/2.0.8)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.7...2.0.8)
- Treat `try` keyword as 2015-edition identifier in definition of try macro ([#1422](https://togithub.com/dtolnay/syn/issues/1422))
### [`v2.0.7`](https://togithub.com/dtolnay/syn/releases/tag/2.0.7)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.6...2.0.7)
- Fix parsing of `mut self` inside of Type::BareFn
### [`v2.0.6`](https://togithub.com/dtolnay/syn/releases/tag/2.0.6)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.5...2.0.6)
- Improve error message on missing ';' between statements ([#1419](https://togithub.com/dtolnay/syn/issues/1419))
- Keep non-brace macro invocations in trailing expr position as Expr::Macro ([#1420](https://togithub.com/dtolnay/syn/issues/1420))
### [`v2.0.5`](https://togithub.com/dtolnay/syn/releases/tag/2.0.5)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.4...2.0.5)
- Expose `ExprMacro` data structure even when `features="full"` is not used ([#1417](https://togithub.com/dtolnay/syn/issues/1417))
### [`v2.0.4`](https://togithub.com/dtolnay/syn/releases/tag/2.0.4)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.3...2.0.4)
- Improve error reporting when parsing identifiers and paths ([#1415](https://togithub.com/dtolnay/syn/issues/1415), [#1416](https://togithub.com/dtolnay/syn/issues/1416))
### [`v2.0.3`](https://togithub.com/dtolnay/syn/releases/tag/2.0.3)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.2...2.0.3)
- Expose `ExprGroup` data structure even when `features="full"` is not used ([#1412](https://togithub.com/dtolnay/syn/issues/1412))
### [`v2.0.2`](https://togithub.com/dtolnay/syn/releases/tag/2.0.2)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.1...2.0.2)
- Documentation improvements
### [`v2.0.1`](https://togithub.com/dtolnay/syn/releases/tag/2.0.1)
[Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.0...2.0.1)
- Add methods on syn::Meta for reporting error on an incorrect kind of attribute ([#1409](https://togithub.com/dtolnay/syn/issues/1409))
### [`v2.0.0`](https://togithub.com/dtolnay/syn/releases/tag/2.0.0)
[Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.109...2.0.0)
This release contains a batch of syntax tree improvements to incorporate ongoing Rust language development from the past 3.5 years since syn 1.
It never seems like an ideal time to finalize a syntax tree design, considering the frankly alarming number of syntax-disrupting language features currently in flight: keyword generics, restrictions, capabilities and contexts, conditional constness, new varieties of literals, dyn revamp such as explicitly dyn-safe traits and dyn-star, expression syntax in various phases of being added or being torn out (const blocks, try blocks, raw references), auto traits and negative impls, generalizations to higher rank trait bounds, async closures and static async trait methods, postfix keywords, pattern types, return type notation, unsafe attributes, …
The plan continues to be the same as laid out originally in the 1.0.0 release announcement:
> Be aware that the underlying Rust language will continue to evolve. Syn is able to accommodate most kinds of Rust grammar changes via the nonexhaustive enums and `Verbatim` variants in the syntax tree, but we will plan to put out new major versions on a 12 to 24 month cadence to incorporate ongoing language changes as needed.
If anything, the takeaway from the 3.5 year longevity of syn 1 is that this period was tamer from a language development perspective than anticipated, but that is unlikely to last and I think around 24 months is still the correct cadence to expect between releases going forward.
### Breaking changes
- Minimum required Rust version is raised from rustc 1.31 to 1.56.
##### Expressions
- Support for `box expr` syntax has been deleted, as it has been deleted recently from rustc.
- Support for type ascription syntax `expr: Type` in expression position has been deleted.
- Support for unstable `&raw const expr` raw-pointer reference syntax has been deleted.
- The representation of generic arguments has been unified between method calls and non-method paths into a single `GenericArgument` type, which supersedes the previous `GenericMethodArgument` and `MethodTurbofish`.
- Generic arguments now distinguish between associated types (`AssocType`) and associated constant values (`AssocConst`). Previously these would be parsed ambiguously as `Binding`.
- The binary assignment operators in `BinOp` have been renamed to align with the naming used by the standard library's `core::ops` module's traits. For example `BinOp::AddEq` is now called `BinOp::AddAssign`.
- `Expr::Struct` struct construction expressions now support structs which are a variant of an enum associated type of a trait, as in `::Assoc::Variant { ... }`, which has recently been added to Rust.
- `Expr::Range` now follows the `start` and `end` naming used by the standard library's `RangeBounds` trait, rather than `from`/`to` or `lo`/`hi`.
- `Expr::AssignOp` has been merged into `Expr::Binary`, which now represents both non-assignment and assignment binary operators.
- Stricter parsing of ranges. None of the following are valid expressions, but were previously accepted by syn: `..=`, `lo..=`, `...`, `...hi`, `lo...`, `lo...hi`.
- `Expr::Closure` now includes a representation for `for<...>` lifetimes.
##### Statements
- Variants `Stmt::Expr` (tail-position expression without trailing semicolon) and `Stmt::Semi` (non-tail expression with trailing semicolon) have been combined into `Stmt::Expr` with the optional semicolon represented by `Option`.
- The syntax tree for `Stmt::Local` has been extended to handle `let`/`else` syntax.
- Macros in statement position are now uniformly parsed as `Stmt::Macro`. Previously these would be disambiguated to `Stmt::Item`, although it was ambiguous whether a macro in statement position would expand to an item (like `thread_local! { ... }`) vs an expression (like `println! { ... }`).
##### Patterns
- Pattern parsing for all the different syntactic positions in which patterns are allowed has been split into `Pat::parse_single` (for function- and closure-argument position, where top-level `|` is not allowed), `Pat::parse_multi` (where `|` is allowed) and `Pat::parse_multi_with_leading_vert` (for the pattern of match arms, which allow an optional leading `|`). Previously only a single `parse` behavior was supported and behaved like the new `parse_single`.
- The `Pat` syntax tree now shares more common data structures with the `Expr` syntax tree where possible, such as for literals, paths, macros, and ranges in pattern position.
- Parsing of struct field patterns does a better job rejecting bogus syntax such as `Struct { 0 asdf }` and `Struct { ref mut 0: asdf }`, which were previously incorrectly accepted.
- `Pat::Range` now supports one-sided ranges by representing the start and end bound of the range by `Option`.
- `Pat::Struct` keeps track of attributes on the optional `..` "rest" part of the pattern, as in `let Struct { x, #[cfg(any())] .. } = _;`.
- Parsing unary negation now enforces that only literal patterns can be unarily negated. For example `-self::CONST` and `-const { 0i32 }` are not valid syntax in pattern position.
- `Pat::TupleStruct` no longer wraps a value of type `PatTuple` but represents that information in its fields directly.
- A single parenthesized pattern without trailing comma inside the parentheses is no longer considered a `Pat::Tuple`, it will be parsed as `Pat::Paren`.
- One-sided range patterns are no longer allowed inside of slice patterns. `[lo..]` and `[..=hi]` are not considered valid pattern syntax by Rust.
##### Items
- Typed `self` in a method signature, such as `self: Pin<&mut Self>`, will now be parsed as `FnArg::Receiver`. This means `self`, whether with or without an explicit type, is always treated as a `Receiver`. Previously only the `&self` and `&mut self` shorthand receivers were parsed as `Receiver`.
- `TraitItem::Method` and `ImplItem::Method` have been renamed to `TraitItem::Fn` and `ImplItem::Fn`, as they do not necessarily represent methods if the function signature contains no `self`.
- `Item::Macro2` has been deleted as "macros 2.0" syntax is no longer considered on track for stabilization.
- Various item kinds now hold `Generics` which didn't used to have them.
- The variadic argument of an extern function signature can now be given an optional parameter name.
- `WherePredicate::Eq` is no longer supported.
- `Visibility::Crate` is no longer supported. This syntax has been removed from rustc.
- Public visibility is now represented by a single `Token![pub]` token rather than the old `VisPublic` struct.
- `LifetimeDef` is now called `LifetimeParam`. This name makes more sense in the context of the `GenericParam` enum (which also includes `TypeParam` and `ConstParam`), and is the name that the Rust Reference uses.
- Modules and extern blocks (`Item::Mod` and `Item::ForeignMod`) can now be marked `unsafe`.
##### Attributes
- The syntax tree for `Attribute` has been redesigned. The new API better accommodates attributes which mix structured and unstructured content at different levels of nesting.
- `AttributeArgs` has been removed. Use `Punctuated`.
- For parsing attribute contents, `parse_meta()` is superseded by a new parsing library called `syn::meta`, and the `parse_nested_meta` method on `Attribute`.
##### Tokens
- In string literals, the handling of non-ASCII whitespace after trailing `\` now matches what is implemented by rustc. Space, horizontal tab, line feed, and carriage return are the only 4 whitespace characters which are supposed to be stripped from the beginning of the next line.
- The delimiter tokens `syn::token::Paren`, `Bracket`, and `Brace` now store 2 spans (the open and close punctuation separately) rather than just 1. Use `.join()` to obtain a single `Span` spanning the whole group.
- Keyword construction now requires a single span; an array of 1 span is no longer accepted. Use `Token![trait](span)` instead of `Token![trait]([span])`.
- Some token types have been renamed to conform with terminology used by the [Rust Reference](https://doc.rust-lang.org/1.68.0/reference/tokens.html#punctuation). These are `Add`->`Plus`, `Bang`->`Not`, `Colon2`->`PathSep`, `Div`->`Slash`, `Dot2`->`DotDot`, `Dot3`->`DotDotDot`, `Rem`->`Percent`, and `Sub`->`Minus`.
##### More
- Several enums have been made `#[non_exhaustive]` in anticipation of upcoming language changes. This includes `WherePredicate`, `Lit`, and `GenericArgument`.
- The `impl Extend> for Punctuated` now requires `P: Default` and will push a default punctuation between the pre-existing elements and the new ones, if there is not already a trailing punctuation. Previously it would panic in this situation.
- `ParseStream::parse_terminated` now takes a peek-style punctuation argument instead of turbofish. Replace `input.parse_terminated::<_, Token![,]>(Thing::parse)` with `input.parse_terminated(Thing::parse, Token![,])`.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[x] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
1
->2
Release Notes
dtolnay/syn
### [`v2.0.13`](https://togithub.com/dtolnay/syn/releases/tag/2.0.13) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.12...2.0.13) - Improve spans of Expr::Field parsed from a float Literal ([#1433](https://togithub.com/dtolnay/syn/issues/1433), [#1436](https://togithub.com/dtolnay/syn/issues/1436)) ### [`v2.0.12`](https://togithub.com/dtolnay/syn/releases/tag/2.0.12) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.11...2.0.12) - Refer to `compile_error!` by absolute path in token stream produced by syn::Error::to_compile_error ([#1431](https://togithub.com/dtolnay/syn/issues/1431), thanks [@smoelius](https://togithub.com/smoelius)) ### [`v2.0.11`](https://togithub.com/dtolnay/syn/releases/tag/2.0.11) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.10...2.0.11) - Improve error message on empty parens inside parse_nested_meta ([#1428](https://togithub.com/dtolnay/syn/issues/1428)) ### [`v2.0.10`](https://togithub.com/dtolnay/syn/releases/tag/2.0.10) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.9...2.0.10) - Fix visibility being parsed incorrectly on macro invocations inside of a trait ### [`v2.0.9`](https://togithub.com/dtolnay/syn/releases/tag/2.0.9) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.8...2.0.9) - Disallow `type` items in an extern block, trait, or module from being marked `default` ### [`v2.0.8`](https://togithub.com/dtolnay/syn/releases/tag/2.0.8) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.7...2.0.8) - Treat `try` keyword as 2015-edition identifier in definition of try macro ([#1422](https://togithub.com/dtolnay/syn/issues/1422)) ### [`v2.0.7`](https://togithub.com/dtolnay/syn/releases/tag/2.0.7) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.6...2.0.7) - Fix parsing of `mut self` inside of Type::BareFn ### [`v2.0.6`](https://togithub.com/dtolnay/syn/releases/tag/2.0.6) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.5...2.0.6) - Improve error message on missing ';' between statements ([#1419](https://togithub.com/dtolnay/syn/issues/1419)) - Keep non-brace macro invocations in trailing expr position as Expr::Macro ([#1420](https://togithub.com/dtolnay/syn/issues/1420)) ### [`v2.0.5`](https://togithub.com/dtolnay/syn/releases/tag/2.0.5) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.4...2.0.5) - Expose `ExprMacro` data structure even when `features="full"` is not used ([#1417](https://togithub.com/dtolnay/syn/issues/1417)) ### [`v2.0.4`](https://togithub.com/dtolnay/syn/releases/tag/2.0.4) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.3...2.0.4) - Improve error reporting when parsing identifiers and paths ([#1415](https://togithub.com/dtolnay/syn/issues/1415), [#1416](https://togithub.com/dtolnay/syn/issues/1416)) ### [`v2.0.3`](https://togithub.com/dtolnay/syn/releases/tag/2.0.3) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.2...2.0.3) - Expose `ExprGroup` data structure even when `features="full"` is not used ([#1412](https://togithub.com/dtolnay/syn/issues/1412)) ### [`v2.0.2`](https://togithub.com/dtolnay/syn/releases/tag/2.0.2) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.1...2.0.2) - Documentation improvements ### [`v2.0.1`](https://togithub.com/dtolnay/syn/releases/tag/2.0.1) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.0...2.0.1) - Add methods on syn::Meta for reporting error on an incorrect kind of attribute ([#1409](https://togithub.com/dtolnay/syn/issues/1409)) ### [`v2.0.0`](https://togithub.com/dtolnay/syn/releases/tag/2.0.0) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.109...2.0.0) This release contains a batch of syntax tree improvements to incorporate ongoing Rust language development from the past 3.5 years since syn 1. It never seems like an ideal time to finalize a syntax tree design, considering the frankly alarming number of syntax-disrupting language features currently in flight: keyword generics, restrictions, capabilities and contexts, conditional constness, new varieties of literals, dyn revamp such as explicitly dyn-safe traits and dyn-star, expression syntax in various phases of being added or being torn out (const blocks, try blocks, raw references), auto traits and negative impls, generalizations to higher rank trait bounds, async closures and static async trait methods, postfix keywords, pattern types, return type notation, unsafe attributes, … The plan continues to be the same as laid out originally in the 1.0.0 release announcement: > Be aware that the underlying Rust language will continue to evolve. Syn is able to accommodate most kinds of Rust grammar changes via the nonexhaustive enums and `Verbatim` variants in the syntax tree, but we will plan to put out new major versions on a 12 to 24 month cadence to incorporate ongoing language changes as needed. If anything, the takeaway from the 3.5 year longevity of syn 1 is that this period was tamer from a language development perspective than anticipated, but that is unlikely to last and I think around 24 months is still the correct cadence to expect between releases going forward.[API documentation for 2.0]
### Breaking changes - Minimum required Rust version is raised from rustc 1.31 to 1.56. ##### Expressions - Support for `box expr` syntax has been deleted, as it has been deleted recently from rustc. - Support for type ascription syntax `expr: Type` in expression position has been deleted. - Support for unstable `&raw const expr` raw-pointer reference syntax has been deleted. - The representation of generic arguments has been unified between method calls and non-method paths into a single `GenericArgument` type, which supersedes the previous `GenericMethodArgument` and `MethodTurbofish`. - Generic arguments now distinguish between associated types (`AssocType`) and associated constant values (`AssocConst`). Previously these would be parsed ambiguously as `Binding`. - The binary assignment operators in `BinOp` have been renamed to align with the naming used by the standard library's `core::ops` module's traits. For example `BinOp::AddEq` is now called `BinOp::AddAssign`. - `Expr::Struct` struct construction expressions now support structs which are a variant of an enum associated type of a trait, as in `Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.