syn icon indicating copy to clipboard operation
syn copied to clipboard

Parser for Rust source code

Results 117 syn issues
Sort by recently updated
recently updated
newest added

Pending acceptance of https://github.com/rust-lang/rfcs/pull/2582.

syntax

As part of the library from #607 -- users will want to generate code that calls visitor / folder methods on specific syntax tree node types. Something like: ```rust impl...

Visiting a particular syntax tree node with [`syn::visit`](https://docs.rs/syn/0.14/syn/visit/index.html), the number of calls to `visit_span` should be equal to the number of tokens when converted into TokenStream. This test would help...

test

This can result in quadratic behavior as each interpolated value is flattened to tokens before being parsed again. ```rust for ... { let x = parse_quote! { ... #x ......

docs

I'm learning how to use `syn`, and after starting with some simple examples, I'm now running into issues that relate to blocks, specifically, how to: * store the `TokenStream` of...

docs

This macro is commonly useful for building a syntax tree and should be featured more prominently. ```rust // Add a trait bound to every type parameter for param in &mut...

docs

Many of our modules have pretty nasty conditional imports. https://github.com/dtolnay/syn/blob/6f03cfcdd9438fb50a7618882d8ec77f3f12cc2b/src/lit.rs#L9-L24 I believe Serde handles this better by having [one shared module](https://github.com/serde-rs/serde/blob/v1.0.27/serde/src/lib.rs#L130-L133) that contains all possible imports and is imported [all...

code quality

Add a test asserting that the upstream [`parse-fail`](https://github.com/rust-lang/rust/tree/master/src/test/parse-fail) test cases each fail to parse. Okay if we need to blacklist some of them to begin with.

test

`serde_json::Value` has an easy way to map an enum variant to an option, e.g. ```rust let val = Value::("abc") assert_eq!(val.as_str(), Some("abc")); assert_eq!(val.as_bool(), None); ``` I feel like this pattern would...

Rustc considers this code syntactically valid, it's only a later stage of compilation that reports an error. Syn does not currently permit these. ```rust #[cfg(any())] fn f(_: impl 'static, _:...

syntax