David Tolnay

Results 358 issues of David Tolnay

Part of RFC 2102. - RFC: https://github.com/rust-lang/rfcs/pull/2102 - Tracking issue: https://github.com/rust-lang/rust/issues/49804 - Example usage: https://github.com/rust-lang/rust/blob/e3c71f1e33b026dea7c9ca7c1c4554e63f56a0da/src/test/pretty/anonymous-types.rs ```rust type A = struct { field: u8 }; ```

syntax

Depending on the outcome of https://github.com/rust-lang/rust/pull/80080. This would be a valid Expr: `::Assoc::Variant {}` The current parse error is: ```console error: expected `;` --> dev/main.rs:5:45 | 5 | let _...

syntax

LitStr::parse currently puts the entire input string's span on every output token. It would be better to try producing smaller spans using [Literal::subspan](https://docs.rs/proc-macro2/1.0.4/proc_macro2/struct.Literal.html#method.subspan).

enhancement
help wanted

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

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

[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.

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

syntax