-
Notifications
You must be signed in to change notification settings - Fork 2
Update Rust crate syn to v2 #83
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
Open
renovate
wants to merge
1
commit into
main
Choose a base branch
from
renovate/syn-2.x
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
06d3d75 to
ddbe512
Compare
ddbe512 to
45fb91d
Compare
59c8d20 to
63f615b
Compare
41b6d07 to
5c2c0ad
Compare
5b73297 to
1e81c4d
Compare
afa1894 to
d2a009c
Compare
d2a009c to
2e99108
Compare
2e99108 to
4f9e7a6
Compare
5c4855e to
92b210d
Compare
3f62b1d to
6029fab
Compare
6029fab to
5759d76
Compare
5759d76 to
0b1f1cb
Compare
0b1f1cb to
3fefa21
Compare
ef37332 to
761e7b5
Compare
d252c13 to
7eb4be8
Compare
7eb4be8 to
da8a202
Compare
912398f to
6888093
Compare
8fcceee to
1269c46
Compare
183ad33 to
3852cbd
Compare
de0dbf1 to
a8090a8
Compare
a8090a8 to
d8d551c
Compare
4f79e47 to
b24fbbb
Compare
19d571e to
67d3d5e
Compare
67d3d5e to
42ff230
Compare
42ff230 to
bcf81ce
Compare
071f02e to
a0b797c
Compare
a0b797c to
e816b1c
Compare
78dc10a to
efe6777
Compare
efe6777 to
fff000f
Compare
a39271d to
3958bf8
Compare
3958bf8 to
cae5df1
Compare
cae5df1 to
cd7f442
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
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.108Compare Source
v2.0.107Compare Source
v2.0.106Compare Source
~constsyntax with[const]conditionally const syntax in trait bounds (#1896, rust-lang/rust#139858)v2.0.105Compare Source
impl !T {}(#1881, rust-lang/rust#144386)v2.0.104Compare Source
v2.0.103Compare Source
v2.0.102Compare Source
v2.0.101Compare Source
v2.0.100Compare Source
Visit::visit_token_stream,VisitMut::visit_token_stream_mut,Fold::fold_token_streamfor processing TokenStream during syntax tree traversals (#1852)v2.0.99Compare Source
v2.0.98Compare Source
ParseStream::callandPunctuatedparsers (#1847)v2.0.97Compare Source
v2.0.96Compare Source
v2.0.95Compare Source
v2.0.94Compare Source
v2.0.93Compare Source
x as T <<= y(#1804),break as T(#1805),match x { _ if .. => {} }(#1807)|| -> T 'a: {}(#1806),if break x {}(#1808, #1810)v2.0.92Compare Source
v2.0.91Compare Source
Vec<Arm>usingparse_quote!(#1796, #1797)v2.0.90Compare Source
(#[attr] thing).field(#1785)(thing.field)()andthing.0()(#1786)v2.0.89Compare Source
v2.0.88Compare Source
parse_str(#1783)v2.0.87Compare Source
Cursor::any_group(#1777)Expr::peek(#1778)v2.0.86Compare Source
parse_quote!to produce Vec<Attribute> (#1775)v2.0.85Compare Source
v2.0.84Compare Source
impl Sized + use<Self>(#1772)v2.0.83Compare Source
v2.0.82Compare Source
Parseimpls for PreciseCapture and CapturedParam (#1757, #1758)unsafeattributes (#1759)v2.0.81Compare Source
impl Trait + use<'a, T>(#1752, #1753, #1754)v2.0.80Compare Source
Expr::RawAddr(#1743)v2.0.79Compare Source
useitems containing absolute paths (#1742)v2.0.78Compare Source
v2.0.77Compare Source
Expr::Tuplein non-"full" mode (#1727)v2.0.76Compare Source
becomekeyword is followed by an expression (#1725)v2.0.75Compare Source
v2.0.74Compare Source
Genericsiterator methods (#1719)v2.0.73Compare Source
Fields::membersiterator (#1716, thanks @Fancyflame)v2.0.72Compare Source
use<'a, T>precise capturing bounds (#1707, thanks @compiler-errors)v2.0.71Compare Source
v2.0.70Compare Source
v2.0.69Compare Source
Punctuated::getandget_mut(#1693)v2.0.68Compare Source
parse_quote!parses invalid syntax (#1690, thanks @stepancheg)GroupandLifetime(#1687)v2.0.67Compare Source
LitCStrin ParseStream::peek (#1682)v2.0.66Compare Source
v2.0.65Compare Source
Foldto compile faster (#1666, #1667, #1668)v2.0.64Compare Source
catch_unwind(#1646)breakandreturnin loop headers (#1656)v2.0.63Compare Source
v2.0.62Compare Source
v2.0.61Compare Source
v2.0.60Compare Source
peek(#1625)v2.0.59Compare Source
c"…"andcr"…"C-string literal syntax asLit::CStr(#1502)v2.0.58Compare Source
$incustom_punctuation!macro (#1611)v2.0.57Compare Source
quotewhen built with default-features disabled and the "proc-macro" feature enabled (#1608, thanks @BD103)v2.0.56Compare Source
v2.0.55Compare Source
v2.0.54Compare Source
custom_keyword!with syn's "printing" feature disabled (#1602)v2.0.53Compare Source
v2.0.52Compare Source
v2.0.51Compare Source
v2.0.50Compare Source
v2.0.49Compare Source
LitStr::parse(#1590)v2.0.48Compare Source
else(#1578)v2.0.47Compare Source
v2.0.46Compare Source
v2.0.45Compare Source
DeriveInputasExpr::Verbatimin non-"full" mode, instead of error (#1513)PatTypewithparse_quote!(#1573)v2.0.44Compare Source
v2.0.43Compare Source
v2.0.42Compare Source
v2.0.41Compare Source
parse_quote!(#1548)v2.0.40Compare Source
v2.0.39Compare Source
v2.0.38Compare Source
boolas a custom keyword (#1518, thanks @Vanille-N)v2.0.37Compare Source
v2.0.36Compare Source
--generate-link-to-definitiondocumentation builds (#1514)v2.0.35Compare Source
Token!macro (#1510, #1512)v2.0.34Compare Source
v2.0.33Compare Source
(/*ERROR*/)placeholder that rustc uses for macros that fail to expandv2.0.32Compare Source
Path::require_identaccessor (#1496, thanks @Fancyflame)v2.0.31Compare Source
v2.0.30Compare Source
v2.0.29Compare Source
v2.0.28Compare Source
v2.0.27Compare Source
v2.0.26Compare Source
SpannedforQSelf(#1465)v2.0.25Compare Source
v2.0.24Compare Source
v2.0.23Compare Source
where [(); { T::COUNT }]:in non-"full" mode (#1478)v2.0.22Compare Source
c"…"c-string literals (tracking issue: rust-lang/rust#105723)v2.0.21Compare Source
LitByteStr::valuein the case of a cooked byte string literal containing form feed or vertical tab characters following an escaped newline (#1474)v2.0.20Compare Source
v2.0.19Compare Source
v2.0.18Compare Source
v2.0.17Compare Source
v2.0.16Compare Source
builtin #syntax as Expr::Verbatim (rust-lang/rust#110680, #1454)v2.0.15Compare Source
Type::Tupleof length 1 prints as a tuple even if trailing comma is not provided in the Punctuated (#1444, thanks @Fancyflame)v2.0.14Compare Source
v2.0.13Compare Source
v2.0.12Compare Source
compile_error!by absolute path in token stream produced by syn::Error::to_compile_error (#1431, thanks @smoelius)v2.0.11Compare Source
v2.0.10Compare Source
v2.0.9Compare Source
typeitems in an extern block, trait, or module from being markeddefaultimpl T { fn f(&self); }— omitted function bodies are allowed by TraitItemFn, but inimplblocks this syntax is now parsed as ImplItem::Verbatim rather than ImplItem::Fnv2.0.8Compare Source
trykeyword as 2015-edition identifier in definition of try macro (#1422)v2.0.7Compare Source
mut selfinside of Type::BareFnv2.0.6Compare Source
v2.0.5Compare Source
ExprMacrodata structure even whenfeatures="full"is not used (#1417)v2.0.4Compare Source
v2.0.3Compare Source
ExprGroupdata structure even whenfeatures="full"is not used (#1412)v2.0.2Compare Source
v2.0.1Compare Source
v2.0.0Compare 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:
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
Expressions
Support for
box exprsyntax has been deleted, as it has been deleted recently from rustc.Support for type ascription syntax
expr: Typein expression position has been deleted.Support for unstable
&raw const exprraw-pointer reference syntax has been deleted.The representation of generic arguments has been unified between method calls and non-method paths into a single
GenericArgumenttype, which supersedes the previousGenericMethodArgumentandMethodTurbofish.Generic arguments now distinguish between associated types (
AssocType) and associated constant values (AssocConst). Previously these would be parsed ambiguously asBinding.The binary assignment operators in
BinOphave been renamed to align with the naming used by the standard library'score::opsmodule's traits. For exampleBinOp::AddEqis now calledBinOp::AddAssign.Expr::Structstruct 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::Rangenow follows thestartandendnaming used by the standard library'sRangeBoundstrait, rather thanfrom/toorlo/hi.Expr::AssignOphas been merged intoExpr::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::Closurenow includes a representation forfor<...>lifetimes.Statements
Variants
Stmt::Expr(tail-position expression without trailing semicolon) andStmt::Semi(non-tail expression with trailing semicolon) have been combined intoStmt::Exprwith the optional semicolon represented byOption<Token![;]>.The syntax tree for
Stmt::Localhas been extended to handlelet/elsesyntax.Macros in statement position are now uniformly parsed as
Stmt::Macro. Previously these would be disambiguated toStmt::Item, although it was ambiguous whether a macro in statement position would expand to an item (likethread_local! { ... }) vs an expression (likeprintln! { ... }).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) andPat::parse_multi_with_leading_vert(for the pattern of match arms, which allow an optional leading|). Previously only a singleparsebehavior was supported and behaved like the newparse_single.The
Patsyntax tree now shares more common data structures with theExprsyntax 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 }andStruct { ref mut 0: asdf }, which were previously incorrectly accepted.Pat::Rangenow supports one-sided ranges by representing the start and end bound of the range byOption<Expr>.Pat::Structkeeps track of attributes on the optional.."rest" part of the pattern, as inlet Struct { x, #[cfg(any())] .. } = _;.Parsing unary negation now enforces that only literal patterns can be unarily negated. For example
-self::CONSTand-const { 0i32 }are not valid syntax in pattern position.Pat::TupleStructno longer wraps a value of typePatTuplebut 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 asPat::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
selfin a method signature, such asself: Pin<&mut Self>, will now be parsed asFnArg::Receiver. This meansself, whether with or without an explicit type, is always treated as aReceiver. Previously only the&selfand&mut selfshorthand receivers were parsed asReceiver.TraitItem::MethodandImplItem::Methodhave been renamed toTraitItem::FnandImplItem::Fn, as they do not necessarily represent methods if the function signature contains noself.Item::Macro2has been deleted as "macros 2.0" syntax is no longer considered on track for stabilization.Various item kinds now hold
Genericswhich didn't used to have them.The variadic argument of an extern function signature can now be given an optional parameter name.
WherePredicate::Eqis no longer supported.Visibility::Crateis no longer supported. This syntax has been removed from rustc.Public visibility is now represented by a single
Token![pub]token rather than the oldVisPublicstruct.LifetimeDefis now calledLifetimeParam. This name makes more sense in the context of theGenericParamenum (which also includesTypeParamandConstParam), and is the name that the Rust Reference uses.Modules and extern blocks (
Item::ModandItem::ForeignMod) can now be markedunsafe.Attributes
The syntax tree for
Attributehas been redesigned. The new API better accommodates attributes which mix structured and unstructured content at different levels of nesting.AttributeArgshas been removed. UsePunctuated<Meta, Token![,]>.For parsing attribute contents,
parse_meta()is superseded by a new parsing library calledsyn::meta, and theparse_nested_metamethod onAttribute.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, andBracenow store 2 spans (the open and close punctuation separately) rather than just 1. Use.join()to obtain a singleSpanspanning the whole group.Keyword construction now requires a single span; an array of 1 span is no longer accepted. Use
Tokeninstead ofToken.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, andSub->Minus.More
Several enums have been made
#[non_exhaustive]in anticipation of upcoming language changes. This includesWherePredicate,Lit, andGenericArgument.The
impl Extend<Pair<T, P>> for Punctuated<T, P>now requiresP: Defaultand 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_terminatednow takes a peek-style punctuation argument instead of turbofish. Replaceinput.parse_terminated::<_, Token![,]>(Thing::parse)withinput.parse_terminated(Thing::parse, Token![,]).v1.0.109Compare Source
v1.0.108Compare Source
LitStr::value(#1381, thanks @ModProg)v1.0.107Compare Source
-Zrustdoc-scrape-exampleson docs.rs for nowv1.0.106Compare Source
v1.0.105Compare Source
dynandimpltype syntax (#1245)v1.0.104Compare Source
PathArguments::is_none()v1.0.103Compare Source
PartialOrdforCursor(#1236, #1237, thanks @CAD97)v1.0.102Compare Source
TokenBuffer(#1223, thanks @CAD97)v1.0.101Compare Source
v1.0.100Compare Source
for<> || -> T {…}(#1212, rust-lang/rust#97362)dyn*provisional syntax (#1213, rust-lang/rust#91611)Struct { #[attr] .. }(#1214)static asyncandstatic async moveclosures (#1215, rust-lang/rust#62290)v1.0.99Compare Source
v1.0.98Compare Source
v1.0.97Compare Source
v1.0.96Compare Source
punct_mut()method onsyn::punctuated::Pairto returnOption<&mut P>(#1183)v1.0.95Compare Source
v1.0.94Compare Source
v1.0.93Compare Source
Somemeans something unusual in the expression namespace of the scope wherecustom_keywordis invoked (#1171, thanks @zakarumych)v1.0.92Compare Source
v1.0.91Compare Source
[
v1.0.90](https://redirect.github.com/dtoConfiguration
📅 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.
This PR was generated by Mend Renovate. View the repository job log.