syn
syn copied to clipboard
Parser for Rust source code
As seen in https://github.com/rust-lang/rust/blob/b9535c0b7d64290b27c4a116262402cd12f77833/tests/rustdoc/non_lifetime_binders.rs. ```rust fn foo() where for
As seen in https://github.com/rust-lang/rust/blob/b9535c0b7d64290b27c4a116262402cd12f77833/tests/ui/associated-type-bounds/return-type-notation/basic.rs. ```rust fn test() {…} ``` https://github.com/rust-lang/rust/pull/109010
The new nested meta parsing APIs are pretty nice, but `syn::meta::parser` returns a `impl Parser` and does not compose very well with other parsing code. How about making `syn::meta::parse_nested_meta` public?...
Could you please update the release notes to describe change 5036fd9c6e9b89809f93a6ffa17ac6663652baed ? It caused mockall to fail in some cases, and I was surprised to see a breaking change missing...
I struggled for quite a while to understand how to deal with the position field of the `syn::QSelf` type. I understand that as an author it is difficult to see...
Hello, thanks for the crate! When looking at `Item` I was surprised not to find APIs that ease its use, without having to pattern-match every time, like for [`rustc_hir::ItemKind`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.ItemKind.html). This...
Here is syn's current RangeLimits enum: https://github.com/dtolnay/syn/blob/391c9c6d1667be37cd5ad4de5fa305ec62296bb8/src/expr.rs#L904-L909 Rustc has the exact same thing: https://github.com/rust-lang/rust/blob/1.67.0/compiler/rustc_ast/src/ast.rs#L1323-L1328 ```rust pub enum RangeLimits { /// Inclusive at the beginning, exclusive at the end HalfOpen, ///...
Something like: ```rust pub struct Token; ``` Then you'd use `Token` for what used to be `Token![+]`, and `Token` instead of `Token![+=]`, etc. The `custom_punctuation!` macro (https://docs.rs/syn/1.0.105/syn/macro.custom_punctuation.html) would no longer...
I'm trying to figure out how to effectively use the new Diagnostic API in lieu of the `Parse` trait's `Result` type, which only emits the old spanned `compiler_error!()` trick. In...
In my use case I'm providing a library that helps with parsing a specific kind of token stream syntax, namely something HTML/JSX-ish: [`syn-rsx`](https://github.com/stoically/syn-rsx). I'd like consumers of the library to...