-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking Issue for RFC 3216: "Allow using for<'a>
syntax when declaring closures"
#97362
Comments
I'd like to work on implementing this 👀 @rustbot claim |
…llot Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](rust-lang#97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc `@Aaron1011` `@cjgillot`
…llot Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](rust-lang#97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](rust-lang/rust#97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Found an ICE involving this feature: #103736 (Maybe we could use an |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [Swatinem/rust-cache](https://togithub.com/Swatinem/rust-cache) | action | patch | `v2.0.0` -> `v2.0.2` | | [clap](https://togithub.com/clap-rs/clap) | dependencies | patch | `3.2.17` -> `3.2.23` | | [const_format](https://togithub.com/rodrimati1992/const_format_crates) | dependencies | patch | `0.2.26` -> `0.2.30` | | [darling](https://togithub.com/TedDriggs/darling) | dependencies | patch | `0.14.1` -> `0.14.2` | | [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.23` -> `0.3.25` | | [proc-macro2](https://togithub.com/dtolnay/proc-macro2) | dependencies | patch | `1.0.43` -> `1.0.47` | | [serde](https://serde.rs) ([source](https://togithub.com/serde-rs/serde)) | dependencies | patch | `1.0.144` -> `1.0.147` | | [serde_json](https://togithub.com/serde-rs/json) | dependencies | patch | `1.0.85` -> `1.0.87` | | [serde_yaml](https://togithub.com/dtolnay/serde-yaml) | dependencies | patch | `0.9.10` -> `0.9.14` | | [snafu](https://togithub.com/shepmaster/snafu) | dependencies | patch | `0.7.1` -> `0.7.3` | | [syn](https://togithub.com/dtolnay/syn) | dependencies | patch | `1.0.99` -> `1.0.103` | | [thiserror](https://togithub.com/dtolnay/thiserror) | dependencies | patch | `1.0.32` -> `1.0.37` | | [tokio](https://tokio.rs) ([source](https://togithub.com/tokio-rs/tokio)) | dependencies | patch | `1.21.1` -> `1.21.2` | | [tracing](https://tokio.rs) ([source](https://togithub.com/tokio-rs/tracing)) | dependencies | patch | `0.1.36` -> `0.1.37` | | [tracing-subscriber](https://tokio.rs) ([source](https://togithub.com/tokio-rs/tracing)) | dependencies | patch | `0.3.15` -> `0.3.16` | --- ### Release Notes <details> <summary>Swatinem/rust-cache</summary> ### [`v2.0.2`](https://togithub.com/Swatinem/rust-cache/releases/tag/v2.0.2) [Compare Source](https://togithub.com/Swatinem/rust-cache/compare/v2.0.1...v2.0.2) - Avoid calling cargo metadata on pre-cleanup. ### [`v2.0.1`](https://togithub.com/Swatinem/rust-cache/releases/tag/v2.0.1) [Compare Source](https://togithub.com/Swatinem/rust-cache/compare/v2.0.0...v2.0.1) - Primarily just updating dependencies to fix GitHub deprecation notices. </details> <details> <summary>clap-rs/clap</summary> ### [`v3.2.23`](https://togithub.com/clap-rs/clap/releases/tag/v3.2.23) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.22...v3.2.23) #### \[3.2.23] - 2022-10-24 ##### Fixes - Upgrade to `textwrap` 0.16 ### [`v3.2.22`](https://togithub.com/clap-rs/clap/releases/tag/v3.2.22) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.21...v3.2.22) ##### \[3.2.22] - 2022-09-16 ##### Fixes - Unify dependencies on `terminal_size` to the 0.2 release ### [`v3.2.21`](https://togithub.com/clap-rs/clap/releases/tag/v3.2.21) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.20...v3.2.21) #### \[3.2.21] - 2022-09-12 ##### Features - `TypedValueParser::map` to allow reusing existing value parsers for other purposes ### [`v3.2.20`](https://togithub.com/clap-rs/clap/releases/tag/v3.2.20) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.19...v3.2.20) #### \[3.2.20] - 2022-09-02 ##### Features - `ArgMatches::get_count` help for `ArgAction::Count` - `ArgMatches::get_flag` help for `ArgAction::SetTrue` / `ArgAction::SetFalse` ### [`v3.2.19`](https://togithub.com/clap-rs/clap/releases/tag/v3.2.19) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.18...v3.2.19) #### \[3.2.19] - 2022-08-30 ##### Fixes - *(help)* Ensure required arguments for parent commands aren't shown in their subcommands when using `args_conflicts_with_subcommand` ### [`v3.2.18`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3218---2022-08-29) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.17...v3.2.18) ##### Fixes - *(help)* `Command::print_help` now respects `Command::colored_help` - *(derive)* Improved error messages </details> <details> <summary>rodrimati1992/const_format_crates</summary> ### [`v0.2.29`](https://togithub.com/rodrimati1992/const_format_crates/blob/HEAD/Changelog.md#​0229) Added lowercase hexadecimal formatting support. Breaking: to add lowercase hexadecimal formatting, this crate changed the uppercase hexadecimal formatter from `{:x}` to `{:X}` ### [`v0.2.27`](https://togithub.com/rodrimati1992/const_format_crates/blob/HEAD/Changelog.md#​0227) Replacing existing features with these: - `"rust_1_64"`: superceeding the soft-deprecated `"more_str_macros"` feature. - `"rust_1_51"`: superceeding the soft-deprecated `"const_generics"` feature. The new features are enabled by the feature they superceede. Now the `"fmt"` feature enables the `"rust_1_64"` feature. </details> <details> <summary>TedDriggs/darling</summary> ### [`v0.14.2`](https://togithub.com/TedDriggs/darling/blob/HEAD/CHANGELOG.md#v0142-October-26-2022) [Compare Source](https://togithub.com/TedDriggs/darling/compare/v0.14.1...v0.14.2) - Derived impls of `FromMeta` will now error on literals, rather than silently ignoring them. [#​193](https://togithub.com/TedDriggs/darling/pull/193) - Don't include property paths in compile errors when spans are available. [#​203](https://togithub.com/TedDriggs/darling/pull/203) </details> <details> <summary>rust-lang/futures-rs</summary> ### [`v0.3.25`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#​0325---2022-10-20) [Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.24...0.3.25) - Fix soundness issue in `join!` and `try_join!` macros ([#​2649](https://togithub.com/rust-lang/futures-rs/issues/2649)) - Implement `Clone` for `sink::Drain` ([#​2650](https://togithub.com/rust-lang/futures-rs/issues/2650)) ### [`v0.3.24`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#​0324---2022-08-29) [Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.23...0.3.24) - Fix incorrect termination of `select_with_strategy` streams ([#​2635](https://togithub.com/rust-lang/futures-rs/issues/2635)) </details> <details> <summary>dtolnay/proc-macro2</summary> ### [`v1.0.47`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.47) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.46...1.0.47) - Fix integer overflow when nesting depth of nested comments exceeds 4 billion ([#​357](https://togithub.com/dtolnay/proc-macro2/issues/357)) ### [`v1.0.46`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.46) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.45...1.0.46) - Make proc_macro2::TokenStream's `FromStr` impl consistent with proc_macro::TokenStream's on strings that begin with a byte order mark `\u{feff}` ([#​353](https://togithub.com/dtolnay/proc-macro2/issues/353)) ### [`v1.0.45`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.45) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.44...1.0.45) - Fix panic on parsing disallowed raw identifiers such as `r#self` ([#​351](https://togithub.com/dtolnay/proc-macro2/issues/351)) ### [`v1.0.44`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.44) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.43...1.0.44) - Expose `span.before()` and `span.after()` to access an empty `Span` located immediately before or after the input span ([#​348](https://togithub.com/dtolnay/proc-macro2/issues/348), upstream tracking issue: [https://github.com/rust-lang/rust/issues/87552](https://togithub.com/rust-lang/rust/issues/87552)) </details> <details> <summary>serde-rs/serde</summary> ### [`v1.0.147`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.147) [Compare Source](https://togithub.com/serde-rs/serde/compare/v1.0.146...v1.0.147) - Add `serde::de::value::EnumAccessDeserializer` which transforms an `EnumAccess` into a `Deserializer` ([#​2305](https://togithub.com/serde-rs/serde/issues/2305)) ### [`v1.0.146`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.146) [Compare Source](https://togithub.com/serde-rs/serde/compare/v1.0.145...v1.0.146) - Allow internally tagged newtype variant to contain unit ([#​2303](https://togithub.com/serde-rs/serde/issues/2303), thanks [@​tage64](https://togithub.com/tage64)) ### [`v1.0.145`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.145) [Compare Source](https://togithub.com/serde-rs/serde/compare/v1.0.144...v1.0.145) - Allow RefCell\<T>, Mutex\<T>, and RwLock\<T> to be serialized regardless of whether T is `Sized` ([#​2282](https://togithub.com/serde-rs/serde/issues/2282), thanks [@​ChayimFriedman2](https://togithub.com/ChayimFriedman2)) </details> <details> <summary>serde-rs/json</summary> ### [`v1.0.87`](https://togithub.com/serde-rs/json/releases/tag/v1.0.87) [Compare Source](https://togithub.com/serde-rs/json/compare/v1.0.86...v1.0.87) - Add `write_i128` and `write_u128` methods to `serde_json::Formatter` to control the formatting of 128-bit integers ([#​940](https://togithub.com/serde-rs/json/issues/940), thanks [@​Lucretiel](https://togithub.com/Lucretiel)) ### [`v1.0.86`](https://togithub.com/serde-rs/json/releases/tag/v1.0.86) [Compare Source](https://togithub.com/serde-rs/json/compare/v1.0.85...v1.0.86) - Support `arbitrary_precision` feature even in no-std mode ([#​928](https://togithub.com/serde-rs/json/issues/928), thanks [@​kvinwang](https://togithub.com/kvinwang)) </details> <details> <summary>dtolnay/serde-yaml</summary> ### [`v0.9.14`](https://togithub.com/dtolnay/serde-yaml/releases/tag/0.9.14) [Compare Source](https://togithub.com/dtolnay/serde-yaml/compare/0.9.13...0.9.14) - Implement `Deserializer` for `TaggedValue` and `&TaggedValue` ([#​339](https://togithub.com/dtolnay/serde-yaml/issues/339)) ### [`v0.9.13`](https://togithub.com/dtolnay/serde-yaml/releases/tag/0.9.13) [Compare Source](https://togithub.com/dtolnay/serde-yaml/compare/0.9.12...0.9.13) - Recognize `True`, `TRUE`, `False`, `FALSE` as booleans, `Null`, `NULL` as null ([#​330](https://togithub.com/dtolnay/serde-yaml/issues/330)) ### [`v0.9.12`](https://togithub.com/dtolnay/serde-yaml/releases/tag/0.9.12) [Compare Source](https://togithub.com/dtolnay/serde-yaml/compare/0.9.11...0.9.12) - Support deserializing tagged literal scalar into primitive ([#​327](https://togithub.com/dtolnay/serde-yaml/issues/327)) ```yaml "foo": !!int |- 7200 ``` ### [`v0.9.11`](https://togithub.com/dtolnay/serde-yaml/releases/tag/0.9.11) [Compare Source](https://togithub.com/dtolnay/serde-yaml/compare/0.9.10...0.9.11) - Serialize strings on a single line when they do not already contain a newline character, regardless of string length ([#​321](https://togithub.com/dtolnay/serde-yaml/issues/321), [#​322](https://togithub.com/dtolnay/serde-yaml/issues/322)) </details> <details> <summary>shepmaster/snafu</summary> ### [`v0.7.3`](https://togithub.com/shepmaster/snafu/blob/HEAD/CHANGELOG.md#​073---2022-10-20) [Compare Source](https://togithub.com/shepmaster/snafu/compare/0.7.2...0.7.3) ##### Fixed - The macro no longer generates invalid code when implicitly-generated types (such as backtraces) were used in conjunction with `#[snafu(source(from))]` and the type before transformation does not implement `std::error::Error`. [0.7.3]: https://togithub.com/shepmaster/snafu/releases/tag/0.7.3 ### [`v0.7.2`](https://togithub.com/shepmaster/snafu/blob/HEAD/CHANGELOG.md#​072---2022-10-09) [Compare Source](https://togithub.com/shepmaster/snafu/compare/0.7.1...0.7.2) ##### Added - `Report` can be returned from `main` or test functions to provide a user-friendly display of errors. - A cheat sheet for the most common `#[snafu(...)]` attribute usages has been added to the `Snafu` macro's documentation. - Optional support for using the standard library's `std::backtrace::Backtrace` type via the `backtraces-impl-std` feature flag. - Optional support for implementing the Provider API using the `std::error::Error::provide` method via the `unstable-provider-api` feature flag. - Optional support for implementing the `core::error::Error` trait instead of `std::error::Error` via the `unstable-core-error` feature flag. - `GenerateImplicitData` has a new method `generate_with_source`. ##### Changed - `ErrorCompat::iter_chain` and `ChainCompat` are now available in no_std environments. - `ChainCompat` now implements `Clone`. - The `Debug` implementation for `Location` no longer shows some irrelevant internal details. [0.7.2]: https://togithub.com/shepmaster/snafu/releases/tag/0.7.2 </details> <details> <summary>dtolnay/syn</summary> ### [`v1.0.103`](https://togithub.com/dtolnay/syn/releases/tag/1.0.103) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.102...1.0.103) - Implement `PartialOrd` for `Cursor` ([#​1236](https://togithub.com/dtolnay/syn/issues/1236), [#​1237](https://togithub.com/dtolnay/syn/issues/1237), thanks [@​CAD97](https://togithub.com/CAD97)) ### [`v1.0.102`](https://togithub.com/dtolnay/syn/releases/tag/1.0.102) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.101...1.0.102) - More efficient internal representation for `TokenBuffer` ([#​1223](https://togithub.com/dtolnay/syn/issues/1223), thanks [@​CAD97](https://togithub.com/CAD97)) - Fix parsing of a left shift after macro metavariable in type position ([#​1229](https://togithub.com/dtolnay/syn/issues/1229)) ### [`v1.0.101`](https://togithub.com/dtolnay/syn/releases/tag/1.0.101) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.100...1.0.101) - Eliminate a bunch of redundant work done by LitStr::parse ([#​1221](https://togithub.com/dtolnay/syn/issues/1221)) ### [`v1.0.100`](https://togithub.com/dtolnay/syn/releases/tag/1.0.100) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.99...1.0.100) - Parse closures with explicit empty lifetime parameter list `for<> || -> T {…}` ([#​1212](https://togithub.com/dtolnay/syn/issues/1212), [https://github.com/rust-lang/rust/issues/97362](https://togithub.com/rust-lang/rust/issues/97362)) - Parse `dyn*` provisional syntax ([#​1213](https://togithub.com/dtolnay/syn/issues/1213), [https://github.com/rust-lang/rust/issues/91611](https://togithub.com/rust-lang/rust/issues/91611)) - Parse attributes on the "rest" pattern of a struct in pattern position, `Struct { #[attr] .. }` ([#​1214](https://togithub.com/dtolnay/syn/issues/1214)) - Parse `static async` and `static async move` closures ([#​1215](https://togithub.com/dtolnay/syn/issues/1215), [https://github.com/rust-lang/rust/issues/62290](https://togithub.com/rust-lang/rust/issues/62290)) </details> <details> <summary>dtolnay/thiserror</summary> ### [`v1.0.37`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.37) [Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.36...1.0.37) - Documentation improvements ### [`v1.0.36`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.36) [Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.35...1.0.36) - Documentation improvements ([#​195](https://togithub.com/dtolnay/thiserror/issues/195), thanks [@​matklad](https://togithub.com/matklad)) ### [`v1.0.35`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.35) [Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.34...1.0.35) - More work on integrating [std::any::Provider](https://doc.rust-lang.org/std/any/trait.Provider.html) for backtrace support - Fix *"Multiple applicable `provide` methods in scope"* error when the caller has both std::error::Error and std::any::Provide traits in scope ([#​185](https://togithub.com/dtolnay/thiserror/issues/185)) ### [`v1.0.34`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.34) [Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.33...1.0.34) - Tweak "generic member access" based Backtrace implementation ([#​184](https://togithub.com/dtolnay/thiserror/issues/184)) ### [`v1.0.33`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.33) [Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.32...1.0.33) - Expose backtraces via the new "generic member access" API on the Error trait ([https://github.com/rust-lang/rust/issues/99301](https://togithub.com/rust-lang/rust/issues/99301), [https://github.com/rust-lang/rust/issues/96024](https://togithub.com/rust-lang/rust/issues/96024)) </details> <details> <summary>tokio-rs/tokio</summary> ### [`v1.21.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.21.2) [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.21.1...tokio-1.21.2) ### 1.21.2 (September 27, 2022) This release removes the dependency on the `once_cell` crate to restore the MSRV of 1.21.x, which is the latest minor version at the time of release. ([#​5048]) [#​5048]: https://togithub.com/tokio-rs/tokio/pull/5048 </details> <details> <summary>tokio-rs/tracing</summary> ### [`v0.1.37`](https://togithub.com/tokio-rs/tracing/releases/tag/tracing-0.1.37) [Compare Source](https://togithub.com/tokio-rs/tracing/compare/tracing-0.1.36...tracing-0.1.37) This release of `tracing` incorporates changes from `tracing-core` [v0.1.30][core-0.1.30] and `tracing-attributes` [v0.1.23][attrs-0.1.23], including the new `Subscriber::on_register_dispatch` method for performing late initialization after a `Subscriber` is registered as a `Dispatch`, and bugfixes for the `#[instrument]` attribute. Additionally, it fixes instances of the `bare_trait_objects` lint, which is now a warning on `tracing`'s MSRV and will become an error in the next edition. ##### Fixed - **attributes**: Incorrect handling of inner attributes in `#[instrument]`ed functions ([#​2307]) - **attributes**: Incorrect location of compiler diagnostic spans generated for type errors in `#[instrument]`ed `async fn`s ([#​2270]) - **attributes**: Updated `syn` dependency to fix compilation with `-Z minimal-versions` ([#​2246]) - `bare_trait_objects` warning in `valueset!` macro expansion ([#​2308]) ##### Added - **core**: `Subscriber::on_register_dispatch` method ([#​2269]) - **core**: `WeakDispatch` type and `Dispatch::downgrade()` function ([#​2293]) ##### Changed - `tracing-core`: updated to [0.1.30][core-0.1.30] - `tracing-attributes`: updated to [0.1.23][attrs-0.1.23] ##### Documented - Added [`tracing-web`][tracing-web] and [`reqwest-tracing`][reqwest-tracing] to related crates ([#​2283], [#​2331]) Thanks to new contributors [@​compiler-errors](https://togithub.com/compiler-errors), [@​e-nomem](https://togithub.com/e-nomem), [@​WorldSEnder](https://togithub.com/WorldSEnder), [@​Xiami2012](https://togithub.com/Xiami2012), and [@​tl-rodrigo-gryzinski](https://togithub.com/tl-rodrigo-gryzinski), as well as [@​jswrenn](https://togithub.com/jswrenn) and [@​CAD97](https://togithub.com/CAD97), for contributing to this release! [core-0.1.30]: https://togithub.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.30 [attrs-0.1.23]: https://togithub.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.23 [`tracing-web`]: https://crates.io/crates/tracing-web/ [`reqwest-tracing`]: https://crates.io/crates/reqwest-tracing/ [#​2246]: https://togithub.com/tokio-rs/tracing/pull/2246 [#​2269]: https://togithub.com/tokio-rs/tracing/pull/2269 [#​2283]: https://togithub.com/tokio-rs/tracing/pull/2283 [#​2270]: https://togithub.com/tokio-rs/tracing/pull/2270 [#​2293]: https://togithub.com/tokio-rs/tracing/pull/2293 [#​2307]: https://togithub.com/tokio-rs/tracing/pull/2307 [#​2308]: https://togithub.com/tokio-rs/tracing/pull/2308 [#​2331]: https://togithub.com/tokio-rs/tracing/pull/2331 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5:00 and before 6:00 every weekday" in timezone Europe/Berlin, 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. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/stackabletech/operator-rs). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMTcuMCIsInVwZGF0ZWRJblZlciI6IjM0LjE0LjAifQ==-->
Suggestion: could it be allowed to elide the return type of an explicitly higher-ranked closure when it is |
@Jules-Bertholet I don't think it's a good idea, we may want to allow inferring return type in the future, just like with normal closures. |
@WaffleLapkin "Infer return type when it is |
@Jules-Bertholet oh, I misunderstood this as "make |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [syn](https://togithub.com/dtolnay/syn) | dependencies | major | `1` -> `2` | --- ### Release Notes <details> <summary>dtolnay/syn</summary> ### [`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. <br> <p align="center"><a href="https://docs.rs/syn/2/syn/">[API documentation for 2.0]</a></p> ### 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](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<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`](https://togithub.com/dtolnay/syn/compare/1.0.108...1.0.109) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.108...1.0.109) ### [`v1.0.108`](https://togithub.com/dtolnay/syn/releases/tag/1.0.108) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.107...1.0.108) - Fix handling of unusual whitespace after escaped newlines in `LitStr::value` ([#​1381](https://togithub.com/dtolnay/syn/issues/1381), thanks [@​ModProg](https://togithub.com/ModProg)) ### [`v1.0.107`](https://togithub.com/dtolnay/syn/releases/tag/1.0.107) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.106...1.0.107) - Opt out of `-Zrustdoc-scrape-examples` on docs.rs for now ### [`v1.0.106`](https://togithub.com/dtolnay/syn/releases/tag/1.0.106) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.105...1.0.106) - Documentation improvements ### [`v1.0.105`](https://togithub.com/dtolnay/syn/releases/tag/1.0.105) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.104...1.0.105) - Improve parse errors related to `dyn` and `impl` type syntax ([#​1245](https://togithub.com/dtolnay/syn/issues/1245)) ### [`v1.0.104`](https://togithub.com/dtolnay/syn/releases/tag/1.0.104) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.103...1.0.104) - Add `PathArguments::is_none()` ### [`v1.0.103`](https://togithub.com/dtolnay/syn/releases/tag/1.0.103) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.102...1.0.103) - Implement `PartialOrd` for `Cursor` ([#​1236](https://togithub.com/dtolnay/syn/issues/1236), [#​1237](https://togithub.com/dtolnay/syn/issues/1237), thanks [@​CAD97](https://togithub.com/CAD97)) ### [`v1.0.102`](https://togithub.com/dtolnay/syn/releases/tag/1.0.102) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.101...1.0.102) - More efficient internal representation for `TokenBuffer` ([#​1223](https://togithub.com/dtolnay/syn/issues/1223), thanks [@​CAD97](https://togithub.com/CAD97)) - Fix parsing of a left shift after macro metavariable in type position ([#​1229](https://togithub.com/dtolnay/syn/issues/1229)) ### [`v1.0.101`](https://togithub.com/dtolnay/syn/releases/tag/1.0.101) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.100...1.0.101) - Eliminate a bunch of redundant work done by LitStr::parse ([#​1221](https://togithub.com/dtolnay/syn/issues/1221)) ### [`v1.0.100`](https://togithub.com/dtolnay/syn/releases/tag/1.0.100) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.99...1.0.100) - Parse closures with explicit empty lifetime parameter list `for<> || -> T {…}` ([#​1212](https://togithub.com/dtolnay/syn/issues/1212), [https://github.com/rust-lang/rust/issues/97362](https://togithub.com/rust-lang/rust/issues/97362)) - Parse `dyn*` provisional syntax ([#​1213](https://togithub.com/dtolnay/syn/issues/1213), [https://github.com/rust-lang/rust/issues/91611](https://togithub.com/rust-lang/rust/issues/91611)) - Parse attributes on the "rest" pattern of a struct in pattern position, `Struct { #[attr] .. }` ([#​1214](https://togithub.com/dtolnay/syn/issues/1214)) - Parse `static async` and `static async move` closures ([#​1215](https://togithub.com/dtolnay/syn/issues/1215), [https://github.com/rust-lang/rust/issues/62290](https://togithub.com/rust-lang/rust/issues/62290)) ### [`v1.0.99`](https://togithub.com/dtolnay/syn/releases/tag/1.0.99) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.98...1.0.99) - Add categories and keywords to crates.io metadata ### [`v1.0.98`](https://togithub.com/dtolnay/syn/releases/tag/1.0.98) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.97...1.0.98) - Format example code with rustfmt ### [`v1.0.97`](https://togithub.com/dtolnay/syn/releases/tag/1.0.97) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.96...1.0.97) - Update examples ### [`v1.0.96`](https://togithub.com/dtolnay/syn/releases/tag/1.0.96) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.95...1.0.96) - Add a `punct_mut()` method on `syn::punctuated::Pair` to return `Option<&mut P>` ([#​1183](https://togithub.com/dtolnay/syn/issues/1183)) ### [`v1.0.95`](https://togithub.com/dtolnay/syn/releases/tag/1.0.95) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.94...1.0.95) - Replace unicode-xid with unicode-ident crate: https://github.com/dtolnay/unicode-ident ### [`v1.0.94`](https://togithub.com/dtolnay/syn/releases/tag/1.0.94) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.93...1.0.94) - Resolve some unused_macro_rules warnings ### [`v1.0.93`](https://togithub.com/dtolnay/syn/releases/tag/1.0.93) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.92...1.0.93) - Fix compile error when `Some` means something unusual in the expression namespace of the scope where `custom_keyword` is invoked ([#​1171](https://togithub.com/dtolnay/syn/issues/1171), thanks [@​zakarumych](https://togithub.com/zakarumych)) ### [`v1.0.92`](https://togithub.com/dtolnay/syn/releases/tag/1.0.92) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.91...1.0.92) - Make compatible with Miri's tag-raw-pointers mode ([#​1166](https://togithub.com/dtolnay/syn/issues/1166), thanks [@​saethlin](https://togithub.com/saethlin)) ### [`v1.0.91`](https://togithub.com/dtolnay/syn/releases/tag/1.0.91) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.90...1.0.91) - impl ToTokens for RangeLimits - impl Parse for ExprAwait - impl Parse for GenericMethodArgument - impl Parse for MethodTurbofish ### [`v1.0.90`](https://togithub.com/dtolnay/syn/releases/tag/1.0.90) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.89...1.0.90) - Update recommended exhaustive matching idiom to use `non_exhaustive_omitted_patterns` lint: ```rust 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`](https://togithub.com/dtolnay/syn/releases/tag/1.0.89) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.88...1.0.89) - Remove support for inner attributes on non-block expressions ([#​1146](https://togithub.com/dtolnay/syn/issues/1146), [https://github.com/rust-lang/rust/pull/83312](https://togithub.com/rust-lang/rust/pull/83312)) - Fix panic on comma after `mut self` in a bare fn type ([#​1148](https://togithub.com/dtolnay/syn/issues/1148)) ### [`v1.0.88`](https://togithub.com/dtolnay/syn/releases/tag/1.0.88) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.87...1.0.88) - Parse `..` pattern in pattern of `let` ([#​1136](https://togithub.com/dtolnay/syn/issues/1136)) - Parse `for<…>` lifetime introducer on closures ([#​1135](https://togithub.com/dtolnay/syn/issues/1135)) - Reject postfix operators after cast ([#​1117](https://togithub.com/dtolnay/syn/issues/1117)) - Implement extra-traits for `Nothing` ([#​1144](https://togithub.com/dtolnay/syn/issues/1144)) ### [`v1.0.87`](https://togithub.com/dtolnay/syn/releases/tag/1.0.87) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.86...1.0.87) - Parse trait bounds containing associated constant constraint ([#​1138](https://togithub.com/dtolnay/syn/issues/1138)) - Change syntax of where-clauses on generic associated types ([#​1071](https://togithub.com/dtolnay/syn/issues/1071), [https://github.com/rust-lang/rust/issues/89122](https://togithub.com/rust-lang/rust/issues/89122)) ### [`v1.0.86`](https://togithub.com/dtolnay/syn/releases/tag/1.0.86) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.85...1.0.86) - Add support for parsing if- and while-let-chains (RFC 2497) ### [`v1.0.85`](https://togithub.com/dtolnay/syn/releases/tag/1.0.85) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.84...1.0.85) - Add `token()` method to each variant of syn::Lit to expose the underlying token representation with original formatting ### [`v1.0.84`](https://togithub.com/dtolnay/syn/releases/tag/1.0.84) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.83...1.0.84) - Add [`parse_quote_spanned!`](https://docs.rs/syn/1.0.84/syn/macro.parse_quote_spanned.html) macro which is a combination `parse_quote!` + `quote_spanned!` ### [`v1.0.83`](https://togithub.com/dtolnay/syn/releases/tag/1.0.83) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.82...1.0.83) - Fix panic parsing trait impl with qself in trait type: `impl <Thing<>>::Trait for Type {}` ([#​1109](https://togithub.com/dtolnay/syn/issues/1109)) - Preserve attributes on let-else stmt: `#[attr] let pat = val else { return }` ([#​1110](https://togithub.com/dtolnay/syn/issues/1110)) ### [`v1.0.82`](https://togithub.com/dtolnay/syn/releases/tag/1.0.82) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.81...1.0.82) - Support parenthesized generic argument syntax with `::` disambiguator: `Fn::() -> !` ([#​1096](https://togithub.com/dtolnay/syn/issues/1096)) ### [`v1.0.81`](https://togithub.com/dtolnay/syn/releases/tag/1.0.81) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.80...1.0.81) - Support arbitrary precision negative literal tokens on rustc 1.56+ ([#​1087](https://togithub.com/dtolnay/syn/issues/1087), [#​1088](https://togithub.com/dtolnay/syn/issues/1088)) ### [`v1.0.80`](https://togithub.com/dtolnay/syn/releases/tag/1.0.80) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.79...1.0.80) - Parse unstable `~const` syntax in where-clauses ([#​1083](https://togithub.com/dtolnay/syn/issues/1083), tracking issue [https://github.com/rust-lang/rust/issues/67792](https://togithub.com/rust-lang/rust/issues/67792)) ### [`v1.0.79`](https://togithub.com/dtolnay/syn/releases/tag/1.0.79) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.78...1.0.79) - Support trailing `+` in `dyn Trait` syntax, including bare (non-`dyn`) pre-2018 trait object syntax ([#​1075](https://togithub.com/dtolnay/syn/issues/1075), [#​1077](https://togithub.com/dtolnay/syn/issues/1077), [#​1078](https://togithub.com/dtolnay/syn/issues/1078), [#​1079](https://togithub.com/dtolnay/syn/issues/1079), [#​1080](https://togithub.com/dtolnay/syn/issues/1080), [#​1081](https://togithub.com/dtolnay/syn/issues/1081)) ### [`v1.0.78`](https://togithub.com/dtolnay/syn/releases/tag/1.0.78) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.77...1.0.78) - Parse trailing `+` in the bounds of `impl Trait` type ([#​1073](https://togithub.com/dtolnay/syn/issues/1073)) ### [`v1.0.77`](https://togithub.com/dtolnay/syn/releases/tag/1.0.77) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.76...1.0.77) - Match Rust 1.57+'s parsing of dot and question mark after a curly braced macro invocation ([#​1068](https://togithub.com/dtolnay/syn/issues/1068)) ### [`v1.0.76`](https://togithub.com/dtolnay/syn/releases/tag/1.0.76) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.75...1.0.76) - Parse unstable `let`–`else` syntax ([#​1050](https://togithub.com/dtolnay/syn/issues/1050), [#​1057](https://togithub.com/dtolnay/syn/issues/1057)) - Parse qualified braced variant expressions and patterns: `<E>::V {..}` ([#​1058](https://togithub.com/dtolnay/syn/issues/1058), [#​1059](https://togithub.com/dtolnay/syn/issues/1059)) - Fix precedence of outer attributes in front of an assignment expression in statement position ([#​1060](https://togithub.com/dtolnay/syn/issues/1060)) ### [`v1.0.75`](https://togithub.com/dtolnay/syn/releases/tag/1.0.75) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.74...1.0.75) - Improve spans on a method without body inside an impl block - Documentation improvements ([#​922](https://togithub.com/dtolnay/syn/issues/922), thanks [@​Tamschi](https://togithub.com/Tamschi)) ### [`v1.0.74`](https://togithub.com/dtolnay/syn/releases/tag/1.0.74) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.73...1.0.74) - Reject `for<'a> dyn Trait<'a>` syntax; the correct representation is `dyn for<'a> Trait<'a>` ([#​1042](https://togithub.com/dtolnay/syn/issues/1042)) ### [`v1.0.73`](https://togithub.com/dtolnay/syn/releases/tag/1.0.73) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.72...1.0.73) - Add From\<Ident>, From\<Index>, From\<usize> for Member ([#​1038](https://togithub.com/dtolnay/syn/issues/1038), thanks [@​m-ou-se](https://togithub.com/m-ou-se)) ### [`v1.0.72`](https://togithub.com/dtolnay/syn/releases/tag/1.0.72) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.71...1.0.72) - Parse const generics which use value of a previous const generic parameter as a default value ([#​1027](https://togithub.com/dtolnay/syn/issues/1027)) ### [`v1.0.71`](https://togithub.com/dtolnay/syn/releases/tag/1.0.71) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.70...1.0.71) - Fix panic deserializing an ItemImpl with a non-path in trait position ([#​1023](https://togithub.com/dtolnay/syn/issues/1023)) - Parse visibility on impl blocks ([#​1024](https://togithub.com/dtolnay/syn/issues/1024)) - Fix parsing a type parameter default on the first generic parameter of an impl block ([#​1025](https://togithub.com/dtolnay/syn/issues/1025), thanks [@​taiki-e](https://togithub.com/taiki-e)) ### [`v1.0.70`](https://togithub.com/dtolnay/syn/releases/tag/1.0.70) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.69...1.0.70) - Fix precedence of closure body vs ExprRange rhs: `|| .. .method()` ([#​1019](https://togithub.com/dtolnay/syn/issues/1019)) - Parse inner attributes inside of structs and enums ([#​1022](https://togithub.com/dtolnay/syn/issues/1022)) ### [`v1.0.69`](https://togithub.com/dtolnay/syn/releases/tag/1.0.69) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.68...1.0.69) - Improve Parse impls of ExprBox, ExprUnary, ExprLet, ExprClosure, ExprReference, ExprBreak, ExprContinue, ExprReturn, ExprYield to respect precedence for parsing a subexpression beginning with the respective keyword/punctuation ([#​1007](https://togithub.com/dtolnay/syn/issues/1007), [#​1008](https://togithub.com/dtolnay/syn/issues/1008), [#​1009](https://togithub.com/dtolnay/syn/issues/1009), [#​1010](https://togithub.com/dtolnay/syn/issues/1010), [#​1011](https://togithub.com/dtolnay/syn/issues/1011), [#​1012](https://togithub.com/dtolnay/syn/issues/1012), [#​1013](https://togithub.com/dtolnay/syn/issues/1013), [#​1014](https://togithub.com/dtolnay/syn/issues/1014), [#​1015](https://togithub.com/dtolnay/syn/issues/1015)) ### [`v1.0.68`](https://togithub.com/dtolnay/syn/releases/tag/1.0.68) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.67...1.0.68) - Preserve span of `LexError` on conversion to `syn::Error` ([#​1006](https://togithub.com/dtolnay/syn/issues/1006)) ### [`v1.0.67`](https://togithub.com/dtolnay/syn/releases/tag/1.0.67) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.66...1.0.67) - Accept outer attributes in the Parse impl of ExprBlock ([#​1004](https://togithub.com/dtolnay/syn/issues/1004)) ### [`v1.0.66`](https://togithub.com/dtolnay/syn/releases/tag/1.0.66) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.65...1.0.66) - Parse equality constraints on generic associated types ([#​979](https://togithub.com/dtolnay/syn/issues/979)) - Parse default value exprs in const generic declarations ([#​980](https://togithub.com/dtolnay/syn/issues/980)) - Fix infinite loop parsing malformed type ascription expression in non-`full` mode ([#​978](https://togithub.com/dtolnay/syn/issues/978)) - Improve Parse impls of ExprArray, ExprAsync, ExprBlock, ExprMacro, ExprParen, ExprRepeat, ExprStruct, ExprTryBlock, ExprUnsafe to succeed parsing even in the presence of trailing binary operators ([#​991](https://togithub.com/dtolnay/syn/issues/991), [#​992](https://togithub.com/dtolnay/syn/issues/992), [#​993](https://togithub.com/dtolnay/syn/issues/993), [#​994](https://togithub.com/dtolnay/syn/issues/994), [#​995](https://togithub.com/dtolnay/syn/issues/995), [#​996](https://togithub.com/dtolnay/syn/issues/996), [#​997](https://togithub.com/dtolnay/syn/issues/997), [#​998](https://togithub.com/dtolnay/syn/issues/998), [#​999](https://togithub.com/dtolnay/syn/issues/999)) ### [`v1.0.65`](https://togithub.com/dtolnay/syn/releases/tag/1.0.65) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.64...1.0.65) - Parse visibility on macro_rules ([#​981](https://togithub.com/dtolnay/syn/issues/981), tracking issue [rust-lang/rust#​78855](https://togithub.com/rust-lang/rust/issues/78855)) - Parse leading vert in or-patterns ([#​982](https://togithub.com/dtolnay/syn/issues/982), matching the Rust grammar change in [rust-lang/rust#​81869](https://togithub.com/rust-lang/rust/issues/81869)) - Parse static with omitted type ([#​983](https://togithub.com/dtolnay/syn/issues/983)) - Parse placeholder type in type parameter position ([#​984](https://togithub.com/dtolnay/syn/issues/984)) ### [`v1.0.64`](https://togithub.com/dtolnay/syn/releases/tag/1.0.64) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.63...1.0.64) - Avoid `clippy::expl_impl_clone_on_copy` pedantic lint in downstream custom token types ([#​976](https://togithub.com/dtolnay/syn/issues/976)) ### [`v1.0.63`](https://togithub.com/dtolnay/syn/releases/tag/1.0.63) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.62...1.0.63) - Fix parsing associated types with empty trait bound list after colon ([#​974](https://togithub.com/dtolnay/syn/issues/974)) ### [`v1.0.62`](https://togithub.com/dtolnay/syn/releases/tag/1.0.62) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.61...1.0.62) - Republish to work around docs.rs bug [https://github.com/rust-lang/docs.rs/issues/1300](https://togithub.com/rust-lang/docs.rs/issues/1300) ### [`v1.0.61`](https://togithub.com/dtolnay/syn/releases/tag/1.0.61) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.60...1.0.61) - Improve assertion failures on invalid use of `Punctuated` API ([#​970](https://togithub.com/dtolnay/syn/issues/970), thanks [@​osa1](https://togithub.com/osa1)) - Add `Lifetime::span` and `Lifetime::set_span` accessors ([#​971](https://togithub.com/dtolnay/syn/issues/971)) ### [`v1.0.60`](https://togithub.com/dtolnay/syn/releases/tag/1.0.60) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.59...1.0.60) - Provide an idiom for testing exhaustiveness of pattern matches on `Expr`, `Type`, `Pat`, `Item`, `ForeignItem`, `TraitItem`, and `ImplItem` ([#​694](https://togithub.com/dtolnay/syn/issues/694)) ```rust match expr { Expr::Array(e) => {...} Expr::Assign(e) => {...} ... Expr::Yield(e) => {...} #[cfg(test)] Expr::__TestExhaustive(_) => unimplemented!(), #[cfg(not(test))] _ => { /* some sane fallback */ } } ``` The above is the only supported idiom for exhaustive matching of those enum. Do not write anything differently as it is not supported. The conditional compilation on match-arms lets us fail your tests but not break your library when adding a variant. You will be notified by a test failure when a variant is added, so that you can add code to handle it, but your library will continue to compile and work for downstream users in the interim. ### [`v1.0.59`](https://togithub.com/dtolnay/syn/releases/tag/1.0.59) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.58...1.0.59) - Parse empty supertrait lists consistently with rustc ([#​952](https://togithub.com/dtolnay/syn/issues/952)) - Fix loss of span information on comma tokens inside of Type::Tuple during parse ([#​959](https://togithub.com/dtolnay/syn/issues/959)) ### [`v1.0.58`](https://togithub.com/dtolnay/syn/releases/tag/1.0.58) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.57...1.0.58) - Allow literals to parse as a const generic path argument even without "full" feature enabled ([#​951](https://togithub.com/dtolnay/syn/issues/951)) ```rust pub struct Struct { array: Array<10>, // used to require `features = "full"` } ``` ### [`v1.0.57`](https://togithub.com/dtolnay/syn/releases/tag/1.0.57) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.56...1.0.57) - Make Punctuated::new available as a `const fn` ([#​949](https://togithub.com/dtolnay/syn/issues/949)) ### [`v1.0.56`](https://togithub.com/dtolnay/syn/releases/tag/1.0.56) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.55...1.0.56) - Add [`Error::into_compile_error`](https://docs.rs/syn/1.0.56/syn/struct.Error.html#method.into_compile_error) ### [`v1.0.55`](https://togithub.com/dtolnay/syn/releases/tag/1.0.55) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.54...1.0.55) - Preserve None-delimited group around macro metavariable when parsing `T<$ty>` ([#​944](https://togithub.com/dtolnay/syn/issues/944), [#​945](https://togithub.com/dtolnay/syn/issues/945)) ### [`v1.0.54`](https://togithub.com/dtolnay/syn/releases/tag/1.0.54) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.53...1.0.54) - Fix parsing of `impl` items with macro metavariable in the trait path: `impl $trait for Type {...}` ([#​942](https://togithub.com/dtolnay/syn/issues/942)) ### [`v1.0.53`](https://togithub.com/dtolnay/syn/releases/tag/1.0.53) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.52...1.0.53) - Parse `impl !Trait {...}` syntax ([#​936](https://togithub.com/dtolnay/syn/issues/936)) ### [`v1.0.52`](https://togithub.com/dtolnay/syn/releases/tag/1.0.52) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.51...1.0.52) - Parse `unsafe extern` block syntax ([#​918](https://togithub.com/dtolnay/syn/issues/918)) - Parse `unsafe mod` syntax ([#​919](https://togithub.com/dtolnay/syn/issues/919)) - Parse `const {...}` block syntax ([#​921](https://togithub.com/dtolnay/syn/issues/921)) - Parse destructuring assignment syntax ([#​933](https://togithub.com/dtolnay/syn/issues/933)) ### [`v1.0.51`](https://togithub.com/dtolnay/syn/releases/tag/1.0.51) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.50...1.0.51) - Allow parsing signatures in which const generic params appear in front of lifetime params ([#​920](https://togithub.com/dtolnay/syn/issues/920)) ### [`v1.0.50`](https://togithub.com/dtolnay/syn/releases/tag/1.0.50) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.48...1.0.50) - Apply `doc(cfg(...))` on feature gated APIs for docs.rs-rendered documentation ([#​925](https://togithub.com/dtolnay/syn/issues/925)) ### [`v1.0.48`](https://togithub.com/dtolnay/syn/releases/tag/1.0.48) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.47...1.0.48) - Rebuild for https://astexplorer.net ### [`v1.0.47`](https://togithub.com/dtolnay/syn/releases/tag/1.0.47) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.46...1.0.47) - Documentation improvements ### [`v1.0.46`](https://togithub.com/dtolnay/syn/releases/tag/1.0.46) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.45...1.0.46) - Fix parsing structured attributes that contain nested absolute paths, such as `#[derive(::serde::Serialize)]` ([#​909](https://togithub.com/dtolnay/syn/issues/909)) ### [`v1.0.45`](https://togithub.com/dtolnay/syn/releases/tag/1.0.45) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.44...1.0.45) - Provide more detailed error messages when parsing specific literal kind ([#​908](https://togithub.com/dtolnay/syn/issues/908)) ### [`v1.0.44`](https://togithub.com/dtolnay/syn/releases/tag/1.0.44) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.43...1.0.44) - Fix some parsing of patterns inside of None-delimited groups ([#​907](https://togithub.com/dtolnay/syn/issues/907)) ### [`v1.0.43`](https://togithub.com/dtolnay/syn/releases/tag/1.0.43) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.42...1.0.43) - Add Parse impl for syn::Signature ### [`v1.0.42`](https://togithub.com/dtolnay/syn/releases/tag/1.0.42) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.41...1.0.42) - Fix several bugs involving unusual suffixes on integer and floating point literal tokens ([#​898](https://togithub.com/dtolnay/syn/issues/898), [#​899](https://togithub.com/dtolnay/syn/issues/899), [#​900](https://togithub.com/dtolnay/syn/issues/900)) ### [`v1.0.41`](https://togithub.com/dtolnay/syn/releases/tag/1.0.41) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.40...1.0.41) - Fix panic on printing an incomplete (having fewer path segments than originally parsed with) qualified path (ExprPath, PatPath, TypePath containing QSelf) ([#​891](https://togithub.com/dtolnay/syn/issues/891), thanks [@​taiki-e](https://togithub.com/taiki-e)) - Fix panic triggered by syntactically invalid overflowing negative float literal after `.` in a field access position, e.g. `let _ = obj.-0.9E999999` ([#​895](https://togithub.com/dtolnay/syn/issues/895), thanks [@​sameer](https://togithub.com/sameer)) - Enable using `parse_macro_input!` with a Parser function rather than type having a Parse impl ([#​896](https://togithub.com/dtolnay/syn/issues/896), thanks [@​sbrocket](https://togithub.com/sbrocket)) ### [`v1.0.40`](https://togithub.com/dtolnay/syn/releases/tag/1.0.40) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.39...1.0.40) - Fix panic on parsing float literals having both an exponent and a suffix beginning with 'e' or 'E', such as `9e99e999` ([#​893](https://togithub.com/dtolnay/syn/issues/893)) ### [`v1.0.39`](https://togithub.com/dtolnay/syn/releases/tag/1.0.39) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.38...1.0.39) - Improve compile time by pre-expanding derives ([#​885](https://togithub.com/dtolnay/syn/issues/885)) - Parse const generic parameters in any order relative to type parameters ([#​886](https://togithub.com/dtolnay/syn/issues/886)) ### [`v1.0.38`](https://togithub.com/dtolnay/syn/releases/tag/1.0.38) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.37...1.0.38) - Accept traits with parenthesized path arguments in impls ([#​880](https://togithub.com/dtolnay/syn/issues/880), thanks [@​alecmocatta](https://togithub.com/alecmocatta)) ### [`v1.0.37`](https://togithub.com/dtolnay/syn/releases/tag/1.0.37) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.36...1.0.37) - Handle shebang in a way that matches rustc 1.46+ ([#​876](https://togithub.com/dtolnay/syn/issues/876), [https://github.com/rust-lang/rust/pull/71487](https://togithub.com/rust-lang/rust/pull/71487), [https://github.com/rust-lang/rust/pull/73596](https://togithub.com/rust-lang/rust/pull/73596)) ```rust #!//am/i/a/comment fn main() {} // ^ shebang ``` ```rust #!//am/i/a/comment [allow(dead_code)] // ^ not a shebang fn main() {} ``` - Accept <code>tuple.0. 0</code> as a tuple indexing expression ([#​877](https://togithub.com/dtolnay/syn/issues/877)) ### [`v1.0.36`](https://togithub.com/dtolnay/syn/releases/tag/1.0.36) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.35...1.0.36) - Add Lit::span, Lit::set_span ([#​874](https://togithub.com/dtolnay/syn/issues/874)) ### [`v1.0.35`](https://togithub.com/dtolnay/syn/releases/tag/1.0.35) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.34...1.0.35) - Fix parsing of Expr::Field in non-full mode ([#​870](https://togithub.com/dtolnay/syn/issues/870)) ### [`v1.0.34`](https://togithub.com/dtolnay/syn/releases/tag/1.0.34) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.33...1.0.34) - Documentation improvements ### [`v1.0.33`](https://togithub.com/dtolnay/syn/releases/tag/1.0.33) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.32...1.0.33) - Parse `tuple.0.0` as an indexing expression ([https://github.com/rust-lang/rust/pull/71322](https://togithub.com/rust-lang/rust/pull/71322)) - Add `Parse` impls for optional of proc-macro2 types: `Option<TokenTree>`, `Option<Punct>`, `Option<Literal>`, `Option<Group>` ### [`v1.0.32`](https://togithub.com/dtolnay/syn/releases/tag/1.0.32) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.31...1.0.32) - Fix parsing $:item macro_rules metavariables containing outer attributes ([#​852](https://togithub.com/dtolnay/syn/issues/852)) ### [`v1.0.31`](https://togithub.com/dtolnay/syn/releases/tag/1.0.31) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.30...1.0.31) - Add [`Expr::parse_without_eager_brace`](https://docs.rs/syn/1.0.31/syn/enum.Expr.html#method.parse_without_eager_brace) to parse expressions in ambiguous syntactic position. Rust grammar has an ambiguity where braces sometimes turn a path expression into a struct initialization and sometimes do not. In the following code, the expression `S {}` is one expression. Presumably there is an empty struct `struct S {}` defined somewhere which it is instantiating. ```rust let _ = *S {}; // parsed by rustc as: `*(S {})` ``` We would want to parse the above using `Expr::parse` after the `=` token. But in the following, `S {}` is *not* a struct init expression. ```rust if *S {} {} // parsed by rustc as: // // if (*S) { // /* empty block */ // } // { // /* another empty block */ // } ``` For that reason we would want to parse if-conditions using `Expr::parse_without_eager_brace` after the `if` token. Same for similar syntactic positions such as the condition expr after a `while` token or the expr at the top of a `match`. The Rust grammar's choices around which way this ambiguity is resolved at various syntactic positions is fairly arbitrary. Really either parse behavior could work in most positions, and language designers just decide each case based on which is more likely to be what the programmer had in mind most of the time. ```rust if return S {} {} // parsed by rustc as: // // if (return (S {})) { // } // // but could equally well have been this other arbitrary choice: // // if (return S) { // } // {} ``` Note the grammar ambiguity on trailing braces is distinct from precedence and is not captured by assigning a precedence level to the braced struct init expr in relation to other operators. This can be illustrated by `return 0..S {}` vs `match 0..S {}`. The former parses as `return (0..(S {}))` implying tighter precedence for struct init than `..`, while the latter parses as `match (0..S) {}` implying tighter precedence for `..` than struct init, a contradiction. ### [`v1.0.30`](https://togithub.com/dtolnay/syn/releases/tag/1.0.30) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.29...1.0.30) - Parse struct init expressions where the type name is an interpolated macro_rules metavariable, such as `$struct {}` where $struct:ident ([#​842](https://togithub.com/dtolnay/syn/issues/842)) - Handle nesting of None-delimited groups ([#​843](https://togithub.com/dtolnay/syn/issues/843), thanks [@​Aaron1011](https://togithub.com/Aaron1011)) ### [`v1.0.29`](https://togithub.com/dtolnay/syn/releases/tag/1.0.29) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.28...1.0.29) - Parse macro call exprs where the macro name is an interpolated macro_rules metavariable, such as `$macro!()` ([#​838](https://togithub.com/dtolnay/syn/issues/838)) - Parse paths containing generic parameters where the first path segment is an interpolated macro_rules metavariable, such as `$seg<'a>` ([#​839](https://togithub.com/dtolnay/syn/issues/839)) ### [`v1.0.28`](https://togithub.com/dtolnay/syn/releases/tag/1.0.28) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.27...1.0.28) - Recognize empty None-delimited group produced by interpolating a $:vis macro metavariable when parsing a Visibility ([#​836](https://togithub.com/dtolnay/syn/issues/836)) ### [`v1.0.27`](https://togithub.com/dtolnay/syn/releases/tag/1.0.27) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.26...1.0.27) - Parse function calls in which the callee is an interpolated macro variable `$fn(...)` ([#​833](https://togithub.com/dtolnay/syn/issues/833)) ### [`v1.0.26`](https://togithub.com/dtolnay/syn/releases/tag/1.0.26) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.25...1.0.26) - Parse paths containing an interpolated first component, such as `$first::rest` ([https://github.com/rust-lang/rust/issues/72608](https://togithub.com/rust-lang/rust/issues/72608), [#​832](https://togithub.com/dtolnay/syn/issues/832)) ### [`v1.0.25`](https://togithub.com/dtolnay/syn/releases/tag/1.0.25) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.24...1.0.25) - Parse opt-out `?const` trait bounds ([#​767](https://togithub.com/dtolnay/syn/issues/767)) - Parse const generics in method generic arguments ([#​816](https://togithub.com/dtolnay/syn/issues/816), thanks [@​yodaldevoid](https://togithub.com/yodaldevoid)) - Parse trait bounds on type alias items ([#​821](https://togithub.com/dtolnay/syn/issues/821)) - Parse const generics on impl blocks ([#​822](https://togithub.com/dtolnay/syn/issues/822)) - Fix precedence of attributes on binary expressions to match rustc ([#​823](https://togithub.com/dtolnay/syn/issues/823)) - Remove parsing of `extern::` paths which were removed from nightly in January 2019 ([#​825](https://togithub.com/dtolnay/syn/issues/825), [https://github.com/rust-lang/rust/pull/57572](https://togithub.com/rust-lang/rust/pull/57572)) - Add `Punctuated::clear`, analogous to Vec::clear ([#​828](https://togithub.com/dtolnay/syn/issues/828)) ### [`v1.0.24`](https://togithub.com/dtolnay/syn/releases/tag/1.0.24) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.23...1.0.24) - Parse `mut self` receiver in function pointer type ([#​812](https://togithub.com/dtolnay/syn/issues/812), [#​814](https://togithub.com/dtolnay/syn/issues/814)) - Parse const trait impls ([#​813](https://togithub.com/dtolnay/syn/issues/813)) - Improve error reporting inside struct expressions and struct patterns ([#​818](https://togithub.com/dtolnay/syn/issues/818)) ### [`v1.0.23`](https://togithub.com/dtolnay/syn/releases/tag/1.0.23) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.22...1.0.23) - Parse inner attributes in traits ([#​803](https://togithub.com/dtolnay/syn/issues/803)) - Parse const underscore in traits and impls ([#​804](https://togithub.com/dtolnay/syn/issues/804)) - Implement Extend<Error> for Error ([#​805](https://togithub.com/dtolnay/syn/issues/805)) - Parse Or patterns ([#​806](https://togithub.com/dtolnay/syn/issues/806)) - Parse outer attributes on Expr\* structs ([#​807](https://togithub.com/dtolnay/syn/issues/807)) - Parse top level const/static without value ([#​808](https://togithub.com/dtolnay/syn/issues/808)) - Parse syntactically accepted functions ([#​809](https://togithub.com/dtolnay/syn/issues/809)) - Parse extern static with value ([#​810](https://togithub.com/dtolnay/syn/issues/810)) Thanks [@​taiki-e](https://togithub.com/taiki-e) for all of these. ### [`v1.0.22`](https://togithub.com/dtolnay/syn/releases/tag/1.0.22) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.21...1.0.22) - Parse literal suffix on byte string, byte, and char literal tokens: `br#"..."#suffix`, `b'?'suffix`, `'?'suffix` ([#​799](https://togithub.com/dtolnay/syn/issues/799), [#​800](https://togithub.com/dtolnay/syn/issues/800)) ### [`v1.0.21`](https://togithub.com/dtolnay/syn/releases/tag/1.0.21) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.20...1.0.21) - Documentation improvements ### [`v1.0.20`](https://togithub.com/dtolnay/syn/releases/tag/1.0.20) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.19...1.0.20) - Improve span of error message when an error during `syn::Macro::parse_body` is triggered past the last token of the macro body ([#​791](https://togithub.com/dtolnay/syn/issues/791)) ### [`v1.0.19`](https://togithub.com/dtolnay/syn/releases/tag/1.0.19) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.18...1.0.19) - Parse a more lenient extern type syntax inside extern blocks ([#​763](https://togithub.com/dtolnay/syn/issues/763)) ### [`v1.0.18`](https://togithub.com/dtolnay/syn/releases/tag/1.0.18) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.17...1.0.18) - Ignore unparsed empty None-delimited groups at the end of a macro input ([#​783](https://togithub.com/dtolnay/syn/issues/783)) ### [`v1.0.17`](https://togithub.com/dtolnay/syn/releases/tag/1.0.17) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.16...1.0.17) - Expose `syn::Lit` in `default-features = false` mode ### [`v1.0.16`](https://togithub.com/dtolnay/syn/releases/tag/1.0.16) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.15...1.0.16) - Fix parsing of `&raw` raw reference operator ([https://github.com/rust-lang/rust/issues/64490](https://togithub.com/rust-lang/rust/issues/64490)) to require explicitly specified constness, `&raw mut` or `&raw const` ### [`v1.0.15`](https://togithub.com/dtolnay/syn/releases/tag/1.0.15) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.14...1.0.15) - Add [`Punctuated::first_mut`](https://docs.rs/syn/1.0.15/syn/punctuated/struct.Punctuated.html#method.first_mut) to return a mut reference to the first sequence element ### [`v1.0.14`](https://togithub.com/dtolnay/syn/releases/tag/1.0.14) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.13...1.0.14) - Produce more helpful error messages from [Attribute::parse_args](https://docs.rs/syn/1.0/syn/struct.Attribute.html#method.parse_args) ### [`v1.0.13`](https://togithub.com/dtolnay/syn/releases/tag/1.0.13) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.12...1.0.13) - Allow parse_quote! to parse Vec\<Stmt>, with the same behavior as Block::parse_within ([#​741](https://togithub.com/dtolnay/syn/issues/741)) ### [`v1.0.12`](https://togithub.com/dtolnay/syn/releases/tag/1.0.12) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.11...1.0.12) - Reject function signatures with an incorrectly placed receiver parameter, like `fn f(x: u8, &self)` - Produce correctly spanned error when parsing punct beyond the end of a delimited group ([#​739](https://togithub.com/dtolnay/syn/issues/739)) ### [`v1.0.11`](https://togithub.com/dtolnay/syn/releases/tag/1.0.11) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.10...1.0.11) - Implement quote::IdentFragment for syn::Member and syn::Index so that spans are preserved when using these types in quote's `format_ident!` macro ```rust use quote::format_ident; use syn::Index; let index: Index = /* ... */; let ident = format_ident!("__{}", index); // produces __0, __1, etc ``` ### [`v1.0.10`](https://togithub.com/dtolnay/syn/releases/tag/1.0.10) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.9...1.0.10) - Provide `Hash` and `Eq` impls for syn::Member even without "extra-traits" feature enabled, as this type is commonly useful in a hashset ### [`v1.0.9`](https://togithub.com/dtolnay/syn/releases/tag/1.0.9) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.8...1.0.9) - Fix failure to parse tuple struct fields of tuple type starting with `crate` ([#​720](https://togithub.com/dtolnay/syn/issues/720), [#​723](https://togithub.com/dtolnay/syn/issues/723), thanks [@​mystor](https://togithub.com/mystor)) - Fix unexpected tokens being ignored when using Speculative::advance_to ([#​721](https://togithub.com/dtolnay/syn/issues/721), [#​723](https://togithub.com/dtolnay/syn/issues/723), thanks [@​mystor](https://togithub.com/mystor)) ### [`v1.0.8`](https://togithub.com/dtolnay/syn/releases/tag/1.0.8) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.7...1.0.8) - Require trailing comma when parsing TypeTuple with one element ([#​716](https://togithub.com/dtolnay/syn/issues/716), thanks [@​8BitMate](https://togithub.com/8BitMate)) ### [`v1.0.7`](https://togithub.com/dtolnay/syn/releases/tag/1.0.7) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.6...1.0.7) - Add a receiver getter to syn::Signature ([#​714](https://togithub.com/dtolnay/syn/issues/714), thanks [@​mystor](https://togithub.com/mystor)) ```rust impl Signature { /// A method's `self` receiver, such as `&self` or `self: Box<Self>`. pub fn receiver(&self) -> Option<&FnArg>; } ``` ### [`v1.0.6`](https://togithub.com/dtolnay/syn/releases/tag/1.0.6) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.5...1.0.6) - Add conversions from Item{Struct,Enum,Union} into DeriveInput ([#​711](https://togithub.com/dtolnay/syn/issues/711), thanks [@​mystor](https://togithub.com/mystor)) - Add Fields::len and Fields::is_empty ([#​712](https://togithub.com/dtolnay/syn/issues/712), thanks [@​mjbshaw](https://togithub.com/mjbshaw)) ### [`v1.0.5`](https://togithub.com/dtolnay/syn/releases/tag/1.0.5) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.4...1.0.5) - Expose syn::Variadic with just "derive" feature, not "full", because it appears in Type::BareFn ### [`v1.0.4`](https://togithub.com/dtolnay/syn/releases/tag/1.0.4) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.3...1.0.4) - Fix size_hint of Punctuated iterators ([#​700](https://togithub.com/dtolnay/syn/issues/700), thanks [@​ExpHP](https://togithub.com/ExpHP)) ### [`v1.0.3`](https://togithub.com/dtolnay/syn/releases/tag/1.0.3) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.2...1.0.3) - Add [`Path::get_ident`](https://docs.rs/syn/1.0/syn/struct.Path.html#method.get_ident) ([#​696](https://togithub.com/dtolnay/syn/issues/696), thanks [@​infinity0](https://togithub.com/infinity0)) ### [`v1.0.2`](https://togithub.com/dtolnay/syn/releases/tag/1.0.2) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.1...1.0.2) - Documentation improvements ### [`v1.0.1`](https://togithub.com/dtolnay/syn/releases/tag/1.0.1) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.0...1.0.1) - Add [`LitInt::base10_parse`](https://docs.rs/syn/1.0/syn/struct.LitInt.html#method.base10\_parse) to produce error that has the right span when parsing literal digits </details> --- ### 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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/agbrs/agb). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMC4yIiwidXBkYXRlZEluVmVyIjoiMzUuMTcuMSJ9-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [syn](https://togithub.com/dtolnay/syn) | dependencies | major | `1` -> `2` | --- ### Release Notes <details> <summary>dtolnay/syn (syn)</summary> ### [`v2.0.27`](https://togithub.com/dtolnay/syn/releases/tag/2.0.27) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.26...2.0.27) - Documentation improvements (thanks [@​GuillaumeGomez](https://togithub.com/GuillaumeGomez)) ### [`v2.0.26`](https://togithub.com/dtolnay/syn/releases/tag/2.0.26) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.25...2.0.26) - Implement `Spanned` for `QSelf` ([#​1465](https://togithub.com/dtolnay/syn/issues/1465)) ### [`v2.0.25`](https://togithub.com/dtolnay/syn/releases/tag/2.0.25) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.24...2.0.25) - Support single identifier as unbraced const generic argument ([#​1483](https://togithub.com/dtolnay/syn/issues/1483)) - Produce error message when LitStr::parse is used on a suffixed string literal ([#​1484](https://togithub.com/dtolnay/syn/issues/1484)) ### [`v2.0.24`](https://togithub.com/dtolnay/syn/releases/tag/2.0.24) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.23...2.0.24) - Fix duplication of braces around const generic argument in non-full mode ([#​1482](https://togithub.com/dtolnay/syn/issues/1482)) ### [`v2.0.23`](https://togithub.com/dtolnay/syn/releases/tag/2.0.23) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.22...2.0.23) - Preserve attributes on verbatim Item in statement position ([#​1476](https://togithub.com/dtolnay/syn/issues/1476)) - Support generic_const_exprs where-clauses such as `where [(); { T::COUNT }]:` in non-"full" mode ([#​1478](https://togithub.com/dtolnay/syn/issues/1478)) ### [`v2.0.22`](https://togithub.com/dtolnay/syn/releases/tag/2.0.22) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.21...2.0.22) - Parse `c"…"` c-string literals (tracking issue: [https://github.com/rust-lang/rust/issues/105723](https://togithub.com/rust-lang/rust/issues/105723)) ### [`v2.0.21`](https://togithub.com/dtolnay/syn/releases/tag/2.0.21) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.20...2.0.21) - 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](https://togithub.com/dtolnay/syn/issues/1474)) ### [`v2.0.20`](https://togithub.com/dtolnay/syn/releases/tag/2.0.20) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.19...2.0.20) - Documentation improvements ### [`v2.0.19`](https://togithub.com/dtolnay/syn/releases/tag/2.0.19) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.18...2.0.19) - Improve rendering of compile errors within 2015-edition code calling a 2018+ edition proc macro ([#​1467](https://togithub.com/dtolnay/syn/issues/1467), thanks [@​danielhenrymantilla](https://togithub.com/danielhenrymantilla)) ### [`v2.0.18`](https://togithub.com/dtolnay/syn/releases/tag/2.0.18) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.17...2.0.18) - Permit empty attr in syn::meta::parser ([#​1460](https://togithub.com/dtolnay/syn/issues/1460)) ### [`v2.0.17`](https://togithub.com/dtolnay/syn/releases/tag/2.0.17) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.16...2.0.17) - Enable proc_macro support on wasm targets ([#​1459](https://togithub.com/dtolnay/syn/issues/1459)) ### [`v2.0.16`](https://togithub.com/dtolnay/syn/releases/tag/2.0.16) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.15...2.0.16) - Parse `builtin #` syntax as Expr::Verbatim ([https://github.com/rust-lang/rust/issues/110680](https://togithub.com/rust-lang/rust/issues/110680), [#​1454](https://togithub.com/dtolnay/syn/issues/1454)) ### [`v2.0.15`](https://togithub.com/dtolnay/syn/releases/tag/2.0.15) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.14...2.0.15) - Ensure `Type::Tuple` of length 1 prints as a tuple even if trailing comma is not provided in the Punctuated ([#​1444](https://togithub.com/dtolnay/syn/issues/1444), thanks [@​Fancyflame](https://togithub.com/Fancyflame)) ### [`v2.0.14`](https://togithub.com/dtolnay/syn/releases/tag/2.0.14) [Compare Source](https://togithub.com/dtolnay/syn/compare/2.0.13...2.0.14) - Add Punctuated::pop_punct() ([#​1442](https://togithub.com/dtolnay/syn/issues/1442), thanks [@​programmerjake](https://togithub.com/programmerjake)) ### [`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. <br> <p align="center"><a href="https://docs.rs/syn/2/syn/">[API documentation for 2.0]</a></p> ### 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](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<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`](https://togithub.com/dtolnay/syn/compare/1.0.108...1.0.109) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.108...1.0.109) ### [`v1.0.108`](https://togithub.com/dtolnay/syn/releases/tag/1.0.108) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.107...1.0.108) - Fix handling of unusual whitespace after escaped newlines in `LitStr::value` ([#​1381](https://togithub.com/dtolnay/syn/issues/1381), thanks [@​ModProg](https://togithub.com/ModProg)) ### [`v1.0.107`](https://togithub.com/dtolnay/syn/releases/tag/1.0.107) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.106...1.0.107) - Opt out of `-Zrustdoc-scrape-examples` on docs.rs for now ### [`v1.0.106`](https://togithub.com/dtolnay/syn/releases/tag/1.0.106) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.105...1.0.106) - Documentation improvements ### [`v1.0.105`](https://togithub.com/dtolnay/syn/releases/tag/1.0.105) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.104...1.0.105) - Improve parse errors related to `dyn` and `impl` type syntax ([#​1245](https://togithub.com/dtolnay/syn/issues/1245)) ### [`v1.0.104`](https://togithub.com/dtolnay/syn/releases/tag/1.0.104) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.103...1.0.104) - Add `PathArguments::is_none()` ### [`v1.0.103`](https://togithub.com/dtolnay/syn/releases/tag/1.0.103) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.102...1.0.103) - Implement `PartialOrd` for `Cursor` ([#​1236](https://togithub.com/dtolnay/syn/issues/1236), [#​1237](https://togithub.com/dtolnay/syn/issues/1237), thanks [@​CAD97](https://togithub.com/CAD97)) ### [`v1.0.102`](https://togithub.com/dtolnay/syn/releases/tag/1.0.102) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.101...1.0.102) - More efficient internal representation for `TokenBuffer` ([#​1223](https://togithub.com/dtolnay/syn/issues/1223), thanks [@​CAD97](https://togithub.com/CAD97)) - Fix parsing of a left shift after macro metavariable in type position ([#​1229](https://togithub.com/dtolnay/syn/issues/1229)) ### [`v1.0.101`](https://togithub.com/dtolnay/syn/releases/tag/1.0.101) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.100...1.0.101) - Eliminate a bunch of redundant work done by LitStr::parse ([#​1221](https://togithub.com/dtolnay/syn/issues/1221)) ### [`v1.0.100`](https://togithub.com/dtolnay/syn/releases/tag/1.0.100) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.99...1.0.100) - Parse closures with explicit empty lifetime parameter list `for<> || -> T {…}` ([#​1212](https://togithub.com/dtolnay/syn/issues/1212), [https://github.com/rust-lang/rust/issues/97362](https://togithub.com/rust-lang/rust/issues/97362)) - Parse `dyn*` provisional syntax ([#​1213](https://togithub.com/dtolnay/syn/issues/1213), [https://github.com/rust-lang/rust/issues/91611](https://togithub.com/rust-lang/rust/issues/91611)) - Parse attributes on the "rest" pattern of a struct in pattern position, `Struct { #[attr] .. }` ([#​1214](https://togithub.com/dtolnay/syn/issues/1214)) - Parse `static async` and `static async move` closures ([#​1215](https://togithub.com/dtolnay/syn/issues/1215), [https://github.com/rust-lang/rust/issues/62290](https://togithub.com/rust-lang/rust/issues/62290)) ### [`v1.0.99`](https://togithub.com/dtolnay/syn/releases/tag/1.0.99) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.98...1.0.99) - Add categories and keywords to crates.io metadata ### [`v1.0.98`](https://togithub.com/dtolnay/syn/releases/tag/1.0.98) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.97...1.0.98) - Format example code with rustfmt ### [`v1.0.97`](https://togithub.com/dtolnay/syn/releases/tag/1.0.97) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.96...1.0.97) - Update examples ### [`v1.0.96`](https://togithub.com/dtolnay/syn/releases/tag/1.0.96) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.95...1.0.96) - Add a `punct_mut()` method on `syn::punctuated::Pair` to return `Option<&mut P>` ([#​1183](https://togithub.com/dtolnay/syn/issues/1183)) ### [`v1.0.95`](https://togithub.com/dtolnay/syn/releases/tag/1.0.95) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.94...1.0.95) - Replace unicode-xid with unicode-ident crate: https://github.com/dtolnay/unicode-ident ### [`v1.0.94`](https://togithub.com/dtolnay/syn/releases/tag/1.0.94) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.93...1.0.94) - Resolve some unused_macro_rules warnings ### [`v1.0.93`](https://togithub.com/dtolnay/syn/releases/tag/1.0.93) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.92...1.0.93) - Fix compile error when `Some` means something unusual in the expression namespace of the scope where `custom_keyword` is invoked ([#​1171](https://togithub.com/dtolnay/syn/issues/1171), thanks [@​zakarumych](https://togithub.com/zakarumych)) ### [`v1.0.92`](https://togithub.com/dtolnay/syn/releases/tag/1.0.92) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.91...1.0.92) - Make compatible with Miri's tag-raw-pointers mode ([#​1166](https://togithub.com/dtolnay/syn/issues/1166), thanks [@​saethlin](https://togithub.com/saethlin)) ### [`v1.0.91`](https://togithub.com/dtolnay/syn/releases/tag/1.0.91) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.90...1.0.91) - impl ToTokens for RangeLimits - impl Parse for ExprAwait - impl Parse for GenericMethodArgument - impl Parse for MethodTurbofish ### [`v1.0.90`](https://togithub.com/dtolnay/syn/releases/tag/1.0.90) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.89...1.0.90) - Update recommended exhaustive matching idiom to use `non_exhaustive_omitted_patterns` lint: ```rust 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`](https://togithub.com/dtolnay/syn/releases/tag/1.0.89) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.88...1.0.89) - Remove support for inner attributes on non-block expressions ([#​1146](https://togithub.com/dtolnay/syn/issues/1146), [https://github.com/rust-lang/rust/pull/83312](https://togithub.com/rust-lang/rust/pull/83312)) - Fix panic on comma after `mut self` in a bare fn type ([#​1148](https://togithub.com/dtolnay/syn/issues/1148)) ### [`v1.0.88`](https://togithub.com/dtolnay/syn/releases/tag/1.0.88) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.87...1.0.88) - Parse `..` pattern in pattern of `let` ([#​1136](https://togithub.com/dtolnay/syn/issues/1136)) - Parse `for<…>` lifetime introducer on closures ([#​1135](https://togithub.com/dtolnay/syn/issues/1135)) - Reject postfix operators after cast ([#​1117](https://togithub.com/dtolnay/syn/issues/1117)) - Implement extra-traits for `Nothing` ([#​1144](https://togithub.com/dtolnay/syn/issues/1144)) ### [`v1.0.87`](https://togithub.com/dtolnay/syn/releases/tag/1.0.87) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.86...1.0.87) - Parse trait bounds containing associated constant constraint ([#​1138](https://togithub.com/dtolnay/syn/issues/1138)) - Change syntax of where-clauses on generic associated types ([#​1071](https://togithub.com/dtolnay/syn/issues/1071), [https://github.com/rust-lang/rust/issues/89122](https://togithub.com/rust-lang/rust/issues/89122)) ### [`v1.0.86`](https://togithub.com/dtolnay/syn/releases/tag/1.0.86) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.85...1.0.86) - Add support for parsing if- and while-let-chains (RFC 2497) ### [`v1.0.85`](https://togithub.com/dtolnay/syn/releases/tag/1.0.85) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.84...1.0.85) - Add `token()` method to each variant of syn::Lit to expose the underlying token representation with original formatting ### [`v1.0.84`](https://togithub.com/dtolnay/syn/releases/tag/1.0.84) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.83...1.0.84) - Add [`parse_quote_spanned!`](https://docs.rs/syn/1.0.84/syn/macro.parse_quote_spanned.html) macro which is a combination `parse_quote!` + `quote_spanned!` ### [`v1.0.83`](https://togithub.com/dtolnay/syn/releases/tag/1.0.83) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.82...1.0.83) - Fix panic parsing trait impl with qself in trait type: `impl <Thing<>>::Trait for Type {}` ([#​1109](https://togithub.com/dtolnay/syn/issues/1109)) - Preserve attributes on let-else stmt: `#[attr] let pat = val else { return }` ([#​1110](https://togithub.com/dtolnay/syn/issues/1110)) ### [`v1.0.82`](https://togithub.com/dtolnay/syn/releases/tag/1.0.82) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.81...1.0.82) - Support parenthesized generic argument syntax with `::` disambiguator: `Fn::() -> !` ([#​1096](https://togithub.com/dtolnay/syn/issues/1096)) ### [`v1.0.81`](https://togithub.com/dtolnay/syn/releases/tag/1.0.81) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.80...1.0.81) - Support arbitrary precision negative literal tokens on rustc 1.56+ ([#​1087](https://togithub.com/dtolnay/syn/issues/1087), [#​1088](https://togithub.com/dtolnay/syn/issues/1088)) ### [`v1.0.80`](https://togithub.com/dtolnay/syn/releases/tag/1.0.80) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.79...1.0.80) - Parse unstable `~const` syntax in where-clauses ([#​1083](https://togithub.com/dtolnay/syn/issues/1083), tracking issue [https://github.com/rust-lang/rust/issues/67792](https://togithub.com/rust-lang/rust/issues/67792)) ### [`v1.0.79`](https://togithub.com/dtolnay/syn/releases/tag/1.0.79) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.78...1.0.79) - Support trailing `+` in `dyn Trait` syntax, including bare (non-`dyn`) pre-2018 trait object syntax ([#​1075](https://togithub.com/dtolnay/syn/issues/1075), [#​1077](https://togithub.com/dtolnay/syn/issues/1077), [#​1078](https://togithub.com/dtolnay/syn/issues/1078), [#​1079](https://togithub.com/dtolnay/syn/issues/1079), [#​1080](https://togithub.com/dtolnay/syn/issues/1080), [#​1081](https://togithub.com/dtolnay/syn/issues/1081)) ### [`v1.0.78`](https://togithub.com/dtolnay/syn/releases/tag/1.0.78) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.77...1.0.78) - Parse trailing `+` in the bounds of `impl Trait` type ([#​1073](https://togithub.com/dtolnay/syn/issues/1073)) ### [`v1.0.77`](https://togithub.com/dtolnay/syn/releases/tag/1.0.77) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.76...1.0.77) - Match Rust 1.57+'s parsing of dot and question mark after a curly braced macro invocation ([#​1068](https://togithub.com/dtolnay/syn/issues/1068)) ### [`v1.0.76`](https://togithub.com/dtolnay/syn/releases/tag/1.0.76) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.75...1.0.76) - Parse unstable `let`–`else` syntax ([#​1050](https://togithub.com/dtolnay/syn/issues/1050), [#​1057](https://togithub.com/dtolnay/syn/issues/1057)) - Parse qualified braced variant expressions and patterns: `<E>::V {..}` ([#​1058](https://togithub.com/dtolnay/syn/issues/1058), [#​1059](https://togithub.com/dtolnay/syn/issues/1059)) - Fix precedence of outer attributes in front of an assignment expression in statement position ([#​1060](https://togithub.com/dtolnay/syn/issues/1060)) ### [`v1.0.75`](https://togithub.com/dtolnay/syn/releases/tag/1.0.75) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.74...1.0.75) - Improve spans on a method without body inside an impl block - Documentation improvements ([#​922](https://togithub.com/dtolnay/syn/issues/922), thanks [@​Tamschi](https://togithub.com/Tamschi)) ### [`v1.0.74`](https://togithub.com/dtolnay/syn/releases/tag/1.0.74) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.73...1.0.74) - Reject `for<'a> dyn Trait<'a>` syntax; the correct representation is `dyn for<'a> Trait<'a>` ([#​1042](https://togithub.com/dtolnay/syn/issues/1042)) ### [`v1.0.73`](https://togithub.com/dtolnay/syn/releases/tag/1.0.73) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.72...1.0.73) - Add From\<Ident>, From\<Index>, From\<usize> for Member ([#​1038](https://togithub.com/dtolnay/syn/issues/1038), thanks [@​m-ou-se](https://togithub.com/m-ou-se)) ### [`v1.0.72`](https://togithub.com/dtolnay/syn/releases/tag/1.0.72) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.71...1.0.72) - Parse const generics which use value of a previous const generic parameter as a default value ([#​1027](https://togithub.com/dtolnay/syn/issues/1027)) ### [`v1.0.71`](https://togithub.com/dtolnay/syn/releases/tag/1.0.71) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.70...1.0.71) - Fix panic deserializing an ItemImpl with a non-path in trait position ([#​1023](https://togithub.com/dtolnay/syn/issues/1023)) - Parse visibility on impl blocks ([#​1024](https://togithub.com/dtolnay/syn/issues/1024)) - Fix parsing a type parameter default on the first generic parameter of an impl block ([#​1025](https://togithub.com/dtolnay/syn/issues/1025), thanks [@​taiki-e](https://togithub.com/taiki-e)) ### [`v1.0.70`](https://togithub.com/dtolnay/syn/releases/tag/1.0.70) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.69...1.0.70) - Fix precedence of closure body vs ExprRange rhs: `|| .. .method()` ([#​1019](https://togithub.com/dtolnay/syn/issues/1019)) - Parse inner attributes inside of structs and enums ([#​1022](https://togithub.com/dtolnay/syn/issues/1022)) ### [`v1.0.69`](https://togithub.com/dtolnay/syn/releases/tag/1.0.69) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.68...1.0.69) - Improve Parse impls of ExprBox, ExprUnary, ExprLet, ExprClosure, ExprReference, ExprBreak, ExprContinue, ExprReturn, ExprYield to respect precedence for parsing a subexpression beginning with the respective keyword/punctuation ([#​1007](https://togithub.com/dtolnay/syn/issues/1007), [#​1008](https://togithub.com/dtolnay/syn/issues/1008), [#​1009](https://togithub.com/dtolnay/syn/issues/1009), [#​1010](https://togithub.com/dtolnay/syn/issues/1010), [#​1011](https://togithub.com/dtolnay/syn/issues/1011), [#​1012](https://togithub.com/dtolnay/syn/issues/1012), [#​1013](https://togithub.com/dtolnay/syn/issues/1013), [#​1014](https://togithub.com/dtolnay/syn/issues/1014), [#​1015](https://togithub.com/dtolnay/syn/issues/1015)) ### [`v1.0.68`](https://togithub.com/dtolnay/syn/releases/tag/1.0.68) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.67...1.0.68) - Preserve span of `LexError` on conversion to `syn::Error` ([#​1006](https://togithub.com/dtolnay/syn/issues/1006)) ### [`v1.0.67`](https://togithub.com/dtolnay/syn/releases/tag/1.0.67) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.66...1.0.67) - Accept outer attributes in the Parse impl of ExprBlock ([#​1004](https://togithub.com/dtolnay/syn/issues/1004)) ### [`v1.0.66`](https://togithub.com/dtolnay/syn/releases/tag/1.0.66) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.65...1.0.66) - Parse equality constraints on generic associated types ([#​979](https://togithub.com/dtolnay/syn/issues/979)) - Parse default value exprs in const generic declarations ([#​980](https://togithub.com/dtolnay/syn/issues/980)) - Fix infinite loop parsing malformed type ascription expression in non-`full` mode ([#​978](https://togithub.com/dtolnay/syn/issues/978)) - Improve Parse impls of ExprArray, ExprAsync, ExprBlock, ExprMacro, ExprParen, ExprRepeat, ExprStruct, ExprTryBlock, ExprUnsafe to succeed parsing even in the presence of trailing binary operators ([#​991](https://togithub.com/dtolnay/syn/issues/991), [#​992](https://togithub.com/dtolnay/syn/issues/992), [#​993](https://togithub.com/dtolnay/syn/issues/993), [#​994](https://togithub.com/dtolnay/syn/issues/994), [#​995](https://togithub.com/dtolnay/syn/issues/995), [#​996](https://togithub.com/dtolnay/syn/issues/996), [#​997](https://togithub.com/dtolnay/syn/issues/997), [#​998](https://togithub.com/dtolnay/syn/issues/998), [#​999](https://togithub.com/dtolnay/syn/issues/999)) ### [`v1.0.65`](https://togithub.com/dtolnay/syn/releases/tag/1.0.65) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.64...1.0.65) - Parse visibility on macro_rules ([#​981](https://togithub.com/dtolnay/syn/issues/981), tracking issue [rust-lang/rust#78855](https://togithub.com/rust-lang/rust/issues/78855)) - Parse leading vert in or-patterns ([#​982](https://togithub.com/dtolnay/syn/issues/982), matching the Rust grammar change in [rust-lang/rust#81869](https://togithub.com/rust-lang/rust/issues/81869)) - Parse static with omitted type ([#​983](https://togithub.com/dtolnay/syn/issues/983)) - Parse placeholder type in type parameter position ([#​984](https://togithub.com/dtolnay/syn/issues/984)) ### [`v1.0.64`](https://togithub.com/dtolnay/syn/releases/tag/1.0.64) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.63...1.0.64) - Avoid `clippy::expl_impl_clone_on_copy` pedantic lint in downstream custom token types ([#​976](https://togithub.com/dtolnay/syn/issues/976)) ### [`v1.0.63`](https://togithub.com/dtolnay/syn/releases/tag/1.0.63) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.62...1.0.63) - Fix parsing associated types with empty trait bound list after colon ([#​974](https://togithub.com/dtolnay/syn/issues/974)) ### [`v1.0.62`](https://togithub.com/dtolnay/syn/releases/tag/1.0.62) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.61...1.0.62) - Republish to work around docs.rs bug [https://github.com/rust-lang/docs.rs/issues/1300](https://togithub.com/rust-lang/docs.rs/issues/1300) ### [`v1.0.61`](https://togithub.com/dtolnay/syn/releases/tag/1.0.61) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.60...1.0.61) - Improve assertion failures on invalid use of `Punctuated` API ([#​970](https://togithub.com/dtolnay/syn/issues/970), thanks [@​osa1](https://togithub.com/osa1)) - Add `Lifetime::span` and `Lifetime::set_span` accessors ([#​971](https://togithub.com/dtolnay/syn/issues/971)) ### [`v1.0.60`](https://togithub.com/dtolnay/syn/releases/tag/1.0.60) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.59...1.0.60) - Provide an idiom for testing exhaustiveness of pattern matches on `Expr`, `Type`, `Pat`, `Item`, `ForeignItem`, `TraitItem`, and `ImplItem` ([#​694](https://togithub.com/dtolnay/syn/issues/694)) ```rust match expr { Expr::Array(e) => {...} Expr::Assign(e) => {...} ... Expr::Yield(e) => {...} #[cfg(test)] Expr::__TestExhaustive(_) => unimplemented!(), #[cfg(not(test))] _ => { /* some sane fallback */ } } ``` The above is the only supported idiom for exhaustive matching of those enum. Do not write anything differently as it is not supported. The conditional compilation on match-arms lets us fail your tests but not break your library when adding a variant. You will be notified by a test failure when a variant is added, so that you can add code to handle it, but your library will continue to compile and work for downstream users in the interim. ### [`v1.0.59`](https://togithub.com/dtolnay/syn/releases/tag/1.0.59) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.58...1.0.59) - Parse empty supertrait lists consistently with rustc ([#​952](https://togithub.com/dtolnay/syn/issues/952)) - Fix loss of span information on comma tokens inside of Type::Tuple during parse ([#​959](https://togithub.com/dtolnay/syn/issues/959)) ### [`v1.0.58`](https://togithub.com/dtolnay/syn/releases/tag/1.0.58) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.57...1.0.58) - Allow literals to parse as a const generic path argument even without "full" feature enabled ([#​951](https://togithub.com/dtolnay/syn/issues/951)) ```rust pub struct Struct { array: Array<10>, // used to require `features = "full"` } ``` ### [`v1.0.57`](https://togithub.com/dtolnay/syn/releases/tag/1.0.57) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.56...1.0.57) - Make Punctuated::new available as a `const fn` ([#​949](https://togithub.com/dtolnay/syn/issues/949)) ### [`v1.0.56`](https://togithub.com/dtolnay/syn/releases/tag/1.0.56) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.55...1.0.56) - Add [`Error::into_compile_error`](https://docs.rs/syn/1.0.56/syn/struct.Error.html#method.into_compile_error) ### [`v1.0.55`](https://togithub.com/dtolnay/syn/releases/tag/1.0.55) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.54...1.0.55) - Preserve None-delimited group around macro metavariable when parsing `T<$ty>` ([#​944](https://togithub.com/dtolnay/syn/issues/944), [#​945](https://togithub.com/dtolnay/syn/issues/945)) ### [`v1.0.54`](https://togithub.com/dtolnay/syn/releases/tag/1.0.54) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.53...1.0.54) - Fix parsing of `impl` items with macro metavariable in the trait path: `impl $trait for Type {...}` ([#​942](https://togithub.com/dtolnay/syn/issues/942)) ### [`v1.0.53`](https://togithub.com/dtolnay/syn/releases/tag/1.0.53) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.52...1.0.53) - Parse `impl !Trait {...}` syntax ([#​936](https://togithub.com/dtolnay/syn/issues/936)) ### [`v1.0.52`](https://togithub.com/dtolnay/syn/releases/tag/1.0.52) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.51...1.0.52) - Parse `unsafe extern` block syntax ([#​918](https://togithub.com/dtolnay/syn/issues/918)) - Parse `unsafe mod` syntax ([#​919](https://togithub.com/dtolnay/syn/issues/919)) - Parse `const {...}` block syntax ([#​921](https://togithub.com/dtolnay/syn/issues/921)) - Parse destructuring assignment syntax ([#​933](https://togithub.com/dtolnay/syn/issues/933)) ### [`v1.0.51`](https://togithub.com/dtolnay/syn/releases/tag/1.0.51) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.50...1.0.51) - Allow parsing signatures in which const generic params appear in front of lifetime params ([#​920](https://togithub.com/dtolnay/syn/issues/920)) ### [`v1.0.50`](https://togithub.com/dtolnay/syn/releases/tag/1.0.50) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.48...1.0.50) - Apply `doc(cfg(...))` on feature gated APIs for docs.rs-rendered documentation ([#​925](https://togithub.com/dtolnay/syn/issues/925)) ### [`v1.0.48`](https://togithub.com/dtolnay/syn/releases/tag/1.0.48) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.47...1.0.48) - Rebuild for https://astexplorer.net ### [`v1.0.47`](https://togithub.com/dtolnay/syn/releases/tag/1.0.47) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.46...1.0.47) - Documentation improvements ### [`v1.0.46`](https://togithub.com/dtolnay/syn/releases/tag/1.0.46) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.45...1.0.46) - Fix parsing structured attributes that contain nested absolute paths, such as `#[derive(::serde::Serialize)]` ([#​909](https://togithub.com/dtolnay/syn/issues/909)) ### [`v1.0.45`](https://togithub.com/dtolnay/syn/releases/tag/1.0.45) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.44...1.0.45) - Provide more detailed error messages when parsing specific literal kind ([#​908](https://togithub.com/dtolnay/syn/issues/908)) ### [`v1.0.44`](https://togithub.com/dtolnay/syn/releases/tag/1.0.44) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.43...1.0.44) - Fix some parsing of patterns inside of None-delimited groups ([#​907](https://togithub.com/dtolnay/syn/issues/907)) ### [`v1.0.43`](https://togithub.com/dtolnay/syn/releases/tag/1.0.43) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.42...1.0.43) - Add Parse impl for syn::Signature ### [`v1.0.42`](https://togithub.com/dtolnay/syn/releases/tag/1.0.42) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.41...1.0.42) - Fix several bugs involving unusual suffixes on integer and floating point literal tokens ([#​898](https://togithub.com/dtolnay/syn/issues/898), [#​899](https://togithub.com/dtolnay/syn/issues/899), [#​900](https://togithub.com/dtolnay/syn/issues/900)) ### [`v1.0.41`](https://togithub.com/dtolnay/syn/releases/tag/1.0.41) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.40...1.0.41) - Fix panic on printing an incomplete (having fewer path segments than originally parsed with) qualified path (ExprPath, PatPath, TypePath containing QSelf) ([#​891](https://togithub.com/dtolnay/syn/issues/891), thanks [@​taiki-e](https://togithub.com/taiki-e)) - Fix panic triggered by syntactically invalid overflowing negative float literal after `.` in a field access position, e.g. `let _ = obj.-0.9E999999` ([#​895](https://togithub.com/dtolnay/syn/issues/895), thanks [@​sameer](https://togithub.com/sameer)) - Enable using `parse_macro_input!` with a Parser function rather than type having a Parse impl ([#​896](https://togithub.com/dtolnay/syn/issues/896), thanks [@​sbrocket](https://togithub.com/sbrocket)) ### [`v1.0.40`](https://togithub.com/dtolnay/syn/releases/tag/1.0.40) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.39...1.0.40) - Fix panic on parsing float literals having both an exponent and a suffix beginning with 'e' or 'E', such as `9e99e999` ([#​893](https://togithub.com/dtolnay/syn/issues/893)) ### [`v1.0.39`](https://togithub.com/dtolnay/syn/releases/tag/1.0.39) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.38...1.0.39) - Improve compile time by pre-expanding derives ([#​885](https://togithub.com/dtolnay/syn/issues/885)) - Parse const generic parameters in any order relative to type parameters ([#​886](https://togithub.com/dtolnay/syn/issues/886)) ### [`v1.0.38`](https://togithub.com/dtolnay/syn/releases/tag/1.0.38) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.37...1.0.38) - Accept traits with parenthesized path arguments in impls ([#​880](https://togithub.com/dtolnay/syn/issues/880), thanks [@​alecmocatta](https://togithub.com/alecmocatta)) ### [`v1.0.37`](https://togithub.com/dtolnay/syn/releases/tag/1.0.37) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.36...1.0.37) - Handle shebang in a way that matches rustc 1.46+ ([#​876](https://togithub.com/dtolnay/syn/issues/876), [https://github.com/rust-lang/rust/pull/71487](https://togithub.com/rust-lang/rust/pull/71487), [https://github.com/rust-lang/rust/pull/73596](https://togithub.com/rust-lang/rust/pull/73596)) ```rust #!//am/i/a/comment fn main() {} // ^ shebang ``` ```rust #!//am/i/a/comment [allow(dead_code)] // ^ not a shebang fn main() {} ``` - Accept <code>tuple.0. 0</code> as a tuple indexing expression ([#​877](https://togithub.com/dtolnay/syn/issues/877)) ### [`v1.0.36`](https://togithub.com/dtolnay/syn/releases/tag/1.0.36) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.35...1.0.36) - Add Lit::span, Lit::set_span ([#​874](https://togithub.com/dtolnay/syn/issues/874)) ### [`v1.0.35`](https://togithub.com/dtolnay/syn/releases/tag/1.0.35) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.34...1.0.35) - Fix parsing of Expr::Field in non-full mode ([#​870](https://togithub.com/dtolnay/syn/issues/870)) ### [`v1.0.34`](https://togithub.com/dtolnay/syn/releases/tag/1.0.34) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.33...1.0.34) - Documentation improvements ### [`v1.0.33`](https://togithub.com/dtolnay/syn/releases/tag/1.0.33) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.32...1.0.33) - Parse `tuple.0.0` as an indexing expression ([https://github.com/rust-lang/rust/pull/71322](https://togithub.com/rust-lang/rust/pull/71322)) - Add `Parse` impls for optional of proc-macro2 types: `Option<TokenTree>`, `Option<Punct>`, `Option<Literal>`, `Option<Group>` ### [`v1.0.32`](https://togithub.com/dtolnay/syn/releases/tag/1.0.32) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.31...1.0.32) - Fix parsing $:item macro_rules metavariables containing outer attributes ([#​852](https://togithub.com/dtolnay/syn/issues/852)) ### [`v1.0.31`](https://togithub.com/dtolnay/syn/releases/tag/1.0.31) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.30...1.0.31) - Add [`Expr::parse_without_eager_brace`](https://docs.rs/syn/1.0.31/syn/enum.Expr.html#method.parse_without_eager_brace) to parse expressions in ambiguous syntactic position. Rust grammar has an ambiguity where braces sometimes turn a path expression into a struct initialization and sometimes do not. In the following code, the expression `S {}` is one expression. Presumably there is an empty struct `struct S {}` defined somewhere which it is instantiating. ```rust let _ = *S {}; // parsed by rustc as: `*(S {})` ``` We would want to parse the above using `Expr::parse` after the `=` token. But in the following, `S {}` is *not* a struct init expression. ```rust if *S {} {} // parsed by rustc as: // // if (*S) { // /* empty block */ // } // { // /* another empty block */ // } ``` For that reason we would want to parse if-conditions using `Expr::parse_without_eager_brace` after the `if` token. Same for similar syntactic positions such as the condition expr after a `while` token or the expr at the top of a `match`. The Rust grammar's choices around which way this ambiguity is resolved at various syntactic positions is fairly arbitrary. Really either parse behavior could work in most positions, and language designers just decide each case based on which is more likely to be what the programmer had in mind most of the time. ```rust if return S {} {} // parsed by rustc as: // // if (return (S {})) { // } // // but could equally well have been this other arbitrary choice: // // if (return S) { // } // {} ``` Note the grammar ambiguity on trailing braces is distinct from precedence and is not captured by assigning a precedence level to the braced struct init expr in relation to other operators. This can be illustrated by `return 0..S {}` vs `match 0..S {}`. The former parses as `return (0..(S {}))` implying tighter precedence for struct init than `..`, while the latter parses as `match (0..S) {}` implying tighter precedence for `..` than struct init, a contradiction. ### [`v1.0.30`](https://togithub.com/dtolnay/syn/releases/tag/1.0.30) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.29...1.0.30) - Parse struct init expressions where the type name is an interpolated macro_rules metavariable, such as `$struct {}` where $struct:ident ([#​842](https://togithub.com/dtolnay/syn/issues/842)) - Handle nesting of None-delimited groups ([#​843](https://togithub.com/dtolnay/syn/issues/843), thanks [@​Aaron1011](https://togithub.com/Aaron1011)) ### [`v1.0.29`](https://togithub.com/dtolnay/syn/releases/tag/1.0.29) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.28...1.0.29) - Parse macro call exprs where the macro name is an interpolated macro_rules metavariable, such as `$macro!()` ([#​838](https://togithub.com/dtolnay/syn/issues/838)) - Parse paths containing generic parameters where the first path segment is an interpolated macro_rules metavariable, such as `$seg<'a>` ([#​839](https://togithub.com/dtolnay/syn/issues/839)) ### [`v1.0.28`](https://togithub.com/dtolnay/syn/releases/tag/1.0.28) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.27...1.0.28) - Recognize empty None-delimited group produced by interpolating a $:vis macro metavariable when parsing a Visibility ([#​836](https://togithub.com/dtolnay/syn/issues/836)) ### [`v1.0.27`](https://togithub.com/dtolnay/syn/releases/tag/1.0.27) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.26...1.0.27) - Parse function calls in which the callee is an interpolated macro variable `$fn(...)` ([#​833](https://togithub.com/dtolnay/syn/issues/833)) ### [`v1.0.26`](https://togithub.com/dtolnay/syn/releases/tag/1.0.26) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.25...1.0.26) - Parse paths containing an interpolated first component, such as `$first::rest` ([https://github.com/rust-lang/rust/issues/72608](https://togithub.com/rust-lang/rust/issues/72608), [#​832](https://togithub.com/dtolnay/syn/issues/832)) ### [`v1.0.25`](https://togithub.com/dtolnay/syn/releases/tag/1.0.25) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.24...1.0.25) - Parse opt-out `?const` trait bounds ([#​767](https://togithub.com/dtolnay/syn/issues/767)) - Parse const generics in method generic arguments ([#​816](https://togithub.com/dtolnay/syn/issues/816), thanks [@​yodaldevoid](https://togithub.com/yodaldevoid)) - Parse trait bounds on type alias items ([#​821](https://togithub.com/dtolnay/syn/issues/821)) - Parse const generics on impl blocks ([#​822](https://togithub.com/dtolnay/syn/issues/822)) - Fix precedence of attributes on binary expressions to match rustc ([#​823](https://togithub.com/dtolnay/syn/issues/823)) - Remove parsing of `extern::` paths which were removed from nightly in January 2019 ([#​825](https://togithub.com/dtolnay/syn/issues/825), [https://github.com/rust-lang/rust/pull/57572](https://togithub.com/rust-lang/rust/pull/57572)) - Add `Punctuated::clear`, analogous to Vec::clear ([#​828](https://togithub.com/dtolnay/syn/issues/828)) ### [`v1.0.24`](https://togithub.com/dtolnay/syn/releases/tag/1.0.24) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.23...1.0.24) - Parse `mut self` receiver in function pointer type ([#​812](https://togithub.com/dtolnay/syn/issues/812), [#​814](https://togithub.com/dtolnay/syn/issues/814)) - Parse const trait impls ([#​813](https://togithub.com/dtolnay/syn/issues/813)) - Improve error reporting inside struct expressions and struct patterns ([#​818](https://togithub.com/dtolnay/syn/issues/818)) ### [`v1.0.23`](https://togithub.com/dtolnay/syn/releases/tag/1.0.23) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.22...1.0.23) - Parse inner attributes in traits ([#​803](https://togithub.com/dtolnay/syn/issues/803)) - Parse const underscore in traits and impls ([#​804](https://togithub.com/dtolnay/syn/issues/804)) - Implement Extend<Error> for Error ([#​805](https://togithub.com/dtolnay/syn/issues/805)) - Parse Or patterns ([#​806](https://togithub.com/dtolnay/syn/issues/806)) - Parse outer attributes on Expr\* structs ([#​807](https://togithub.com/dtolnay/syn/issues/807)) - Parse top level const/static without value ([#​808](https://togithub.com/dtolnay/syn/issues/808)) - Parse syntactically accepted functions ([#​809](https://togithub.com/dtolnay/syn/issues/809)) - Parse extern static with value ([#​810](https://togithub.com/dtolnay/syn/issues/810)) Thanks [@​taiki-e](https://togithub.com/taiki-e) for all of these. ### [`v1.0.22`](https://togithub.com/dtolnay/syn/releases/tag/1.0.22) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.21...1.0.22) - Parse literal suffix on byte string, byte, and char literal tokens: `br#"..."#suffix`, `b'?'suffix`, `'?'suffix` ([#​799](https://togithub.com/dtolnay/syn/issues/799), [#​800](https://togithub.com/dtolnay/syn/issues/800)) ### [`v1.0.21`](https://togithub.com/dtolnay/syn/releases/tag/1.0.21) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.20...1.0.21) - Documentation improvements ### [`v1.0.20`](https://togithub.com/dtolnay/syn/releases/tag/1.0.20) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.19...1.0.20) - Improve span of error message when an error during `syn::Macro::parse_body` is triggered past the last token of the macro body ([#​791](https://togithub.com/dtolnay/syn/issues/791)) ### [`v1.0.19`](https://togithub.com/dtolnay/syn/releases/tag/1.0.19) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.18...1.0.19) - Parse a more lenient extern type syntax inside extern blocks ([#​763](https://togithub.com/dtolnay/syn/issues/763)) ### [`v1.0.18`](https://togithub.com/dtolnay/syn/releases/tag/1.0.18) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.17...1.0.18) - Ignore unparsed empty None-delimited groups at the end of a macro input ([#​783](https://togithub.com/dtolnay/syn/issues/783)) ### [`v1.0.17`](https://togithub.com/dtolnay/syn/releases/tag/1.0.17) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.16...1.0.17) - Expose `syn::Lit` in `default-features = false` mode ### [`v1.0.16`](https://togithub.com/dtolnay/syn/releases/tag/1.0.16) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.15...1.0.16) - Fix parsing of `&raw` raw reference operator ([https://github.com/rust-lang/rust/issues/64490](https://togithub.com/rust-lang/rust/issues/64490)) to require explicitly specified constness, `&raw mut` or `&raw const` ### [`v1.0.15`](https://togithub.com/dtolnay/syn/releases/tag/1.0.15) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.14...1.0.15) - Add [`Punctuated::first_mut`](https://docs.rs/syn/1.0.15/syn/punctuated/struct.Punctuated.html#method.first_mut) to return a mut reference to the first sequence element ### [`v1.0.14`](https://togithub.com/dtolnay/syn/releases/tag/1.0.14) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.13...1.0.14) - Produce more helpful error messages from [Attribute::parse_args](https://docs.rs/syn/1.0/syn/struct.Attribute.html#method.parse_args) ### [`v1.0.13`](https://togithub.com/dtolnay/syn/releases/tag/1.0.13) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.12...1.0.13) - Allow parse_quote! to parse Vec\<Stmt>, with the same behavior as Block::parse_within ([#​741](https://togithub.com/dtolnay/syn/issues/741)) ### [`v1.0.12`](https://togithub.com/dtolnay/syn/releases/tag/1.0.12) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.11...1.0.12) - Reject function signatures with an incorrectly placed receiver parameter, like `fn f(x: u8, &self)` - Produce correctly spanned error when parsing punct beyond the end of a delimited group ([#​739](https://togithub.com/dtolnay/syn/issues/739)) ### [`v1.0.11`](https://togithub.com/dtolnay/syn/releases/tag/1.0.11) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.10...1.0.11) - Implement quote::IdentFragment for syn::Member and syn::Index so that spans are preserved when using these types in quote's `format_ident!` macro ```rust use quote::format_ident; use syn::Index; let index: Index = /* ... */; let ident = format_ident!("__{}", index); // produces __0, __1, etc ``` ### [`v1.0.10`](https://togithub.com/dtolnay/syn/releases/tag/1.0.10) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.9...1.0.10) - Provide `Hash` and `Eq` impls for syn::Member even without "extra-traits" feature enabled, as this type is commonly useful in a hashset ### [`v1.0.9`](https://togithub.com/dtolnay/syn/releases/tag/1.0.9) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.8...1.0.9) - Fix failure to parse tuple struct fields of tuple type starting with `crate` ([#​720](https://togithub.com/dtolnay/syn/issues/720), [#​723](https://togithub.com/dtolnay/syn/issues/723), thanks [@​mystor](https://togithub.com/mystor)) - Fix unexpected tokens being ignored when using Speculative::advance_to ([#​721](https://togithub.com/dtolnay/syn/issues/721), [#​723](https://togithub.com/dtolnay/syn/issues/723), thank </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), 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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/grafbase/api). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
Is this feature blocked by any ongoing process? The implementation seems completed for a while, maybe we can push this to stabilization? |
same question here. |
A question out of interest: Is this in any way a prerequisite for #68923? |
Unfortunately, #![feature(closure_lifetime_binder)]
#![feature(unboxed_closures)]
fn foo<F>(f: F)
where
F: for<'a> FnOnce<(&'a (),)>,
{}
fn main() {
foo(for<'a> |x: &'a ()| -> &'a () { x }); // COMPILES
foo(|x: &()| -> &() { x }); // DOESN'T COMPILE
} Here is playground: This was discovered because of #34162 . Here is (larger) code, which tries to fix #![feature(closure_lifetime_binder)]
#![feature(unboxed_closures)]
fn sort_by_key<T, F>(s: &mut [T], mut f: F)
where
F: for<'a> FnMut<(&'a T,)>,
// instead of `B: Ord`
for<'a> <F as FnOnce<(&'a T,)>>::Output: Ord,
{
s.sort_by(|a, b| f(a).cmp(&f(b)))
}
#[derive(Debug)]
struct Client(String);
impl Client {
fn key(&self) -> &str {
&self.0
}
}
fn main() {
let mut test = vec![
Client("c".to_string()),
Client("a".to_string()),
Client("b".to_string()),
];
sort_by_key(&mut test, for<'a> |c: &'a Client| -> &'a str { c.key() }); // compiles
//sort_by_key(&mut test, |c: &Client| -> &str { c.key() }); // doesn't compile
dbg!(test);
} The code above compiles on nightly without any additional flags (assuming you choose Also, here is another problematic code, which doesn't require #![feature(closure_lifetime_binder)]
trait X<'a> {
}
impl<'a, T, K> X<'a> for T
where
T: FnOnce(&'a ()) -> K
{}
fn foo<F>(f: F)
where
F: for<'a> X<'a>,
{}
fn main() {
foo(for<'a> |x: &'a ()| -> &'a () { x }); // COMPILES
foo(|x: &()| -> &() { x }); // DOESN'T COMPILE
} playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=bfcdede24f2e7b27380e2990df1af328 |
So you're saying we need the syntactic ability to specifically annotate all closure lifetimes in order to be able to write the programs we want to write? Some kind of |
@workingjubilee , no. We already have such syntax, it is available with |
Ideally, the compiler would infer the most permissive signature possible, and so the |
It is my understanding that the binding of a specific lifetime and a |
@safinaskar As far as I understand compiler internals, a closure is inherently not invariant in regards to the lifetime of the arguments, and you need strong hints in order to make a closure such similar to a normal In other words, the compiler is very conservative when closures could possibly have something like a #![feature(closure_lifetime_binder)]
trait X<'a> {
}
impl<'a, T, K> X<'a> for T
where
T: FnOnce(&'a ()) -> K
{}
fn foo<F>(f: F)
where
F: for<'a> X<'a>,
{}
fn main() {
foo(for<'a> |x: &'a ()| -> &'a () { x }); // COMPILES
// foo(|x: &()| -> &() { x }); // DOESN'T COMPILE
fn hrc_hint<F>(f: F) -> F
where
F: for<'all> FnOnce(&'all ()) -> &'all ()
{
f
}
foo(hrc_hint(|x: &()| -> &() { x })); // NOW COMPILES
} Finally, to avoid this, as far as I can tell, either: the compiler becomes less conservative on closures (possibly E.2024?), we get bounded HRTBs ( |
@runiq I don't know if it's required, it certainly looks helpful but FYI it's not suffficient - I tried using this and the code still doesn't compile. |
Hi! fn f() -> impl Future<Output = ()> + Send {
async {
let data: &[_] = &[0u8];
stream::iter([data])
.map(for<'x> |_data: &'x [u8]| -> future::Ready<()> { future::ready(()) })
.buffer_unordered(1)
.for_each_concurrent(4, |_| async {})
.await;
}
} -> though when I pass the lambda through an identity function that explicitly declares/requires a HRTB lifetime, it then builds: fn lifetime_hrtb<F, R>(f: F) -> F
where
F: for<'a> FnMut(&'a [u8]) -> R,
{
f
}
fn f() -> impl Future<Output = ()> + Send {
async {
let data: &[_] = &[0u8];
stream::iter([data])
.map(lifetime_hrtb(|_data| async {}))
.buffer_unordered(1)
.for_each_concurrent(4, |_| async {})
.await;
}
} any clues as to what's going on? 🙏 edit: this was on |
This is a tracking issue, for the record. If you have a bug with a specific feature, please open a new issue! If you want to discuss the implementation, please also open a new issue and it can be tagged C-discussion. Tracking issues have a linear history so they are not conducive to any kind of discussion. |
This is a tracking issue for the RFC "Allow using
for<'a>
syntax when declaring closures" (rust-lang/rfcs#3216).The feature gate for the issue is
#![feature(closure_lifetime_binder)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
for<>
lifetime binder for closures #98705Unresolved Questions
None at this time
Implementation history
for<>
lifetime binder for closures #98705The text was updated successfully, but these errors were encountered: