Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust crate syn to v2 #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update Rust crate syn to v2 #83

wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 3, 2023

Mend Renovate

This PR contains the following updates:

Package Type Update New value References Sourcegraph
syn dependencies major 2.0.66 source code search for "syn"

Test plan: CI should pass with updated dependencies. No review required: this is an automated dependency update PR.


Release Notes

dtolnay/syn (syn)

v2.0.66

Compare Source

  • Allow braced structs when parsing ExprLet (#​1671)

v2.0.65

Compare Source

v2.0.64

Compare Source

  • Support using ParseBuffer across catch_unwind (#​1646)
  • Validate that the expression in a let-else ends in brace as required by rustc (#​1648, #​1649)
  • Legalize invalid const generic arguments by wrapping in braces (#​1654, #​1655)
  • Fix some expression precedence edge cases involving break and return in loop headers (#​1656)
  • Always print closure bodies with a brace when the closure has an explicit return type (#​1658)
  • Automatically insert necessary parentheses in ToTokens for Expr when required by expression precedence (#​1659)
  • Support struct literal syntax in match guard expressions (#​1662)

v2.0.63

Compare Source

  • Parse and print long if-else-if chains without reliance on deep recursion to avoid overflowing stack (#​1644, #​1645)

v2.0.62

Compare Source

  • Reject invalid unparenthesized range and comparison operator expressions (#​1642, #​1643)

v2.0.61

Compare Source

  • Check for legal binding name in the ident of Pat::Ident (#​1627)
  • Resolve unexpected_cfgs warning (#​1635)

v2.0.60

Compare Source

  • Improve how None-delimited groups are counted by peek (#​1625)

v2.0.59

Compare Source

  • Parse c"…" and cr"…" C-string literal syntax as Lit::CStr (#​1502)

v2.0.58

Compare Source

  • Support $ in custom_punctuation! macro (#​1611)

v2.0.57

Compare Source

  • Eliminate dependency on quote when built with default-features disabled and the "proc-macro" feature enabled (#​1608, thanks @​BD103)

v2.0.56

Compare Source

  • Apply RUSTC_WORKSPACE_WRAPPER when deciding whether to run nightly-only tests (#​1605)

v2.0.55

Compare Source

  • Restore compatibility with rustc 1.56 through 1.59 (#​1603)

v2.0.54

Compare Source

  • Fix dead code warning in generated code when using custom_keyword! with syn's "printing" feature disabled (#​1602)

v2.0.53

Compare Source

  • Implement Copy, Clone, and ToTokens for syn::parse::Nothing (#​1597)

v2.0.52

Compare Source

  • Add an expression parser that uses match-arm's boundary rules (#​1593)

v2.0.51

Compare Source

  • Resolve non_local_definitions warnings in generated code under rustc 1.78-nightly

v2.0.50

Compare Source

  • Fix unused_imports warnings when compiled by rustc 1.78

v2.0.49

Compare Source

  • Improve error location when parsing from an empty string literal using LitStr::parse (#​1590)

v2.0.48

Compare Source

  • Improve error message on unexpected token after else (#​1578)

v2.0.47

Compare Source

  • Improve error messages related to proc_macro::LexError (#​1575)

v2.0.46

Compare Source

  • Update proc-macro2 to fix caching issue when using a rustc-wrapper such as sccache

v2.0.45

Compare Source

  • Parse unsupported expressions in enum discriminants of DeriveInput as Expr::Verbatim in non-"full" mode, instead of error (#​1513)
  • Support parsing PatType with parse_quote! (#​1573)

v2.0.44

Compare Source

  • Documentation improvements

v2.0.43

Compare Source

  • Insert trailing comma if not already present when printing a 1-tuple in pattern position (#​1553)

v2.0.42

Compare Source

  • Documentation improvements

v2.0.41

Compare Source

  • Support parsing syn::Field in parse_quote! (#​1548)

v2.0.40

Compare Source

v2.0.39

Compare Source

  • Fix parsing of return expression in match guards (#​1528)
  • Improve error message on labeled loop as value expression for break (#​1531)

v2.0.38

Compare Source

  • Fix "method 'peek' has an incompatible type for trait" error when defining bool as a custom keyword (#​1518, thanks @​Vanille-N)

v2.0.37

Compare Source

  • Work around incorrect future compatibility warning in rustc 1.74.0-nightly

v2.0.36

Compare Source

  • Restore compatibility with --generate-link-to-definition documentation builds (#​1514)

v2.0.35

Compare Source

  • Make rust-analyzer produce preferred brackets for invocations of Token! macro (#​1510, #​1512)

v2.0.34

Compare Source

  • Documentation improvements

v2.0.33

Compare Source

  • Special handling for the (/*ERROR*/) placeholder that rustc uses for macros that fail to expand

v2.0.32

Compare Source

v2.0.31

Compare Source

v2.0.30

Compare Source

v2.0.29

Compare Source

v2.0.28

Compare Source

  • Fix inconsistency between full and non-full expression parse errors (#​1491)

v2.0.27

Compare Source

v2.0.26

Compare Source

  • Implement Spanned for QSelf (#​1465)

v2.0.25

Compare Source

  • Support single identifier as unbraced const generic argument (#​1483)
  • Produce error message when LitStr::parse is used on a suffixed string literal (#​1484)

v2.0.24

Compare Source

  • Fix duplication of braces around const generic argument in non-full mode (#​1482)

v2.0.23

Compare Source

  • Preserve attributes on verbatim Item in statement position (#​1476)
  • Support generic_const_exprs where-clauses such as where [(); { T::COUNT }]: in non-"full" mode (#​1478)

v2.0.22

Compare Source

v2.0.21

Compare Source

  • Fix value computed by LitByteStr::value in the case of a cooked byte string literal containing form feed or vertical tab characters following an escaped newline (#​1474)

v2.0.20

Compare Source

  • Documentation improvements

v2.0.19

Compare Source

v2.0.18

Compare Source

  • Permit empty attr in syn::meta::parser (#​1460)

v2.0.17

Compare Source

  • Enable proc_macro support on wasm targets (#​1459)

v2.0.16

Compare Source

v2.0.15

Compare Source

  • Ensure Type::Tuple of length 1 prints as a tuple even if trailing comma is not provided in the Punctuated (#​1444, thanks @​Fancyflame)

v2.0.14

Compare Source

v2.0.13

Compare Source

v2.0.12

Compare Source

  • Refer to compile_error! by absolute path in token stream produced by syn::Error::to_compile_error (#​1431, thanks @​smoelius)

v2.0.11

Compare Source

  • Improve error message on empty parens inside parse_nested_meta (#​1428)

v2.0.10

Compare Source

  • Fix visibility being parsed incorrectly on macro invocations inside of a trait

v2.0.9

Compare Source

  • Disallow type items in an extern block, trait, or module from being marked default
  • Disallow ImplItemFn from having an omitted function body, as in impl T { fn f(&self); } — omitted function bodies are allowed by TraitItemFn, but in impl blocks this syntax is now parsed as ImplItem::Verbatim rather than ImplItem::Fn

v2.0.8

Compare Source

  • Treat try keyword as 2015-edition identifier in definition of try macro (#​1422)

v2.0.7

Compare Source

  • Fix parsing of mut self inside of Type::BareFn

v2.0.6

Compare Source

  • Improve error message on missing ';' between statements (#​1419)
  • Keep non-brace macro invocations in trailing expr position as Expr::Macro (#​1420)

v2.0.5

Compare Source

  • Expose ExprMacro data structure even when features="full" is not used (#​1417)

v2.0.4

Compare Source

  • Improve error reporting when parsing identifiers and paths (#​1415, #​1416)

v2.0.3

Compare Source

  • Expose ExprGroup data structure even when features="full" is not used (#​1412)

v2.0.2

Compare Source

  • Documentation improvements

v2.0.1

Compare Source

  • Add methods on syn::Meta for reporting error on an incorrect kind of attribute (#​1409)

v2.0.0

Compare Source

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 <Type as Trait>::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<Token![;]>.

  • 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<Expr>.

  • 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<Meta, Token![,]>.

  • 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. 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<Pair<T, P>> for Punctuated<T, P> 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![,]).

v1.0.109

Compare Source

v1.0.108

Compare Source

  • Fix handling of unusual whitespace after escaped newlines in LitStr::value (#​1381, thanks @​ModProg)

v1.0.107

Compare Source

  • Opt out of -Zrustdoc-scrape-examples on docs.rs for now

v1.0.106

Compare Source

  • Documentation improvements

v1.0.105

Compare Source

  • Improve parse errors related to dyn and impl type syntax (#​1245)

v1.0.104

Compare Source

  • Add PathArguments::is_none()

v1.0.103

Compare Source

v1.0.102

Compare Source

  • More efficient internal representation for TokenBuffer (#​1223, thanks @​CAD97)
  • Fix parsing of a left shift after macro metavariable in type position (#​1229)

v1.0.101

Compare Source

  • Eliminate a bunch of redundant work done by LitStr::parse (#​1221)

v1.0.100

Compare Source

v1.0.99

Compare Source

  • Add categories and keywords to crates.io metadata

v1.0.98

Compare Source

  • Format example code with rustfmt

v1.0.97

Compare Source

  • Update examples

v1.0.96

Compare Source

  • Add a punct_mut() method on syn::punctuated::Pair to return Option<&mut P> (#​1183)

v1.0.95

Compare Source

v1.0.94

Compare Source

  • Resolve some unused_macro_rules warnings

v1.0.93

Compare Source

  • Fix compile error when Some means something unusual in the expression namespace of the scope where custom_keyword is invoked (#​1171, thanks @​zakarumych)

v1.0.92

Compare Source

v1.0.91

Compare Source

  • impl ToTokens for RangeLimits
  • impl Parse for ExprAwait
  • impl Parse for GenericMethodArgument
  • impl Parse for MethodTurbofish

v1.0.90

Compare Source

  • Update recommended exhaustive matching idiom to use non_exhaustive_omitted_patterns lint:

    match expr {
        Expr::Array(e) => {}
        Expr::Assign(e) => {}
        ...
        Expr::Yield(e) => {}
    
        #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))]
        _ => {/* some sane fallback */}
    }

v1.0.89

Compare Source

v1.0.88

Compare Source

  • Parse .. pattern in pattern of let (#​1136)
  • Parse for<…> lifetime introducer on closures (#​1135)
  • Reject postfix operators after cast (#​1117)
  • Implement extra-traits for Nothing (#​1144)

v1.0.87

Compare Source


Configuration

📅 Schedule: Branch creation - "on the 1st through 7th day of the month" in timezone America/Los_Angeles, 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.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the bot label Apr 3, 2023
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from 59c8d20 to 63f615b Compare June 8, 2023 09:30
@renovate renovate bot force-pushed the renovate/syn-2.x branch 3 times, most recently from 41b6d07 to 5c2c0ad Compare June 25, 2023 01:12
@renovate renovate bot force-pushed the renovate/syn-2.x branch 3 times, most recently from 5b73297 to 1e81c4d Compare July 9, 2023 19:59
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from afa1894 to d2a009c Compare July 21, 2023 03:28
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from 5c4855e to 92b210d Compare September 3, 2023 19:45
@renovate renovate bot force-pushed the renovate/syn-2.x branch 5 times, most recently from 3f62b1d to 6029fab Compare September 16, 2023 22:50
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from ef37332 to 761e7b5 Compare December 13, 2023 02:06
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from d252c13 to 7eb4be8 Compare December 25, 2023 06:07
@renovate renovate bot force-pushed the renovate/syn-2.x branch 4 times, most recently from 2c6dc1d to c184873 Compare January 4, 2024 20:14
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from afce301 to 75100b9 Compare February 20, 2024 01:48
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from 994b9db to 7ea538c Compare February 28, 2024 22:07
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from 2cbde82 to 76ad6e5 Compare March 30, 2024 04:53
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from ec83a52 to 9c1f219 Compare April 17, 2024 20:13
@renovate renovate bot force-pushed the renovate/syn-2.x branch 3 times, most recently from 8002753 to 79ac641 Compare May 11, 2024 22:04
@renovate renovate bot force-pushed the renovate/syn-2.x branch 2 times, most recently from e856326 to 283fe60 Compare May 19, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants