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

Use case from #rust: checking if the `segments[..segments.len() - 1]` prefix of a Path is equal to some specific prefix.

enhancement
help wanted

```rust extern "C" fn atexit_callback() { let _ = syn::parse_file("..."); } fn main() { unsafe { libc::atexit(atexit_callback); } } ``` This panicks while constructing a syn::Error parse error. ```console thread...

For parsing the parenthesized part of an attribute like #\[attribute(k = "v")\], `parse_macro_input!(args as AttributeArgs)` works when `attribute` is the currently expanding macro, but if `attribute` is just an inert...

docs

This is used in the [`Parse` impl for `Arm`](https://github.com/dtolnay/syn/blob/80c6889684da7e0a30ef5d0b03e9d73fa6160541/src/expr.rs#L2586), and would be useful when building custom parsing inside and around match statements. CC: udoprog/genco#12

Various pieces of syntax in the parser are currently not robust to idents being wrapped by rustc in a None-delimited group, such as if the ident is associated with a...

test

The `derive(HeapSize)` example [recursively calls `heap_size_of_children` on fields](https://github.com/dtolnay/syn/blob/master/examples/heapsize/heapsize_derive/src/lib.rs#L64), but without adding the correct bound to the fields (`f.ty: HeapSize`). Instead, [trait bounds are added to generic parameters](https://github.com/dtolnay/syn/blob/master/examples/heapsize/heapsize_derive/src/lib.rs#L39). Why? I guess...

docs

[Current:](https://docs.rs/syn/1.0/syn/parse/struct.ParseBuffer.html#method.parse_terminated) ```rust input.parse_terminated::(MyAttr::parse) ``` Proposed: ```rust input.parse_terminated(MyAttr::parse, Token![,]) ```

breaking change

Use the verbatim variant idea from #251 to parse a braced expression in #263 as just a verbatim tokenstream expression.

This snippet of code from `dtoa` fails parsing with `syn` 1.0.13: ```rust pub trait Floating { fn write(self, W) -> io::Result; } ``` Giving the error ``Error("expected `:`")``. This is...

I'm trying to parse a macro call (along the lines of `foo! { }`) inside an `ItemFn`. When looking at `Stmt`, I initially guessed this would be an expression, and...