David Tolnay

Results 700 comments of David Tolnay

I noticed that `$self` by itself is currently not valid syntax (as of https://github.com/rust-lang/rust/issues/40107). ``` error: missing fragment specifier --> src/main.rs:2:11 | 2 | ($self, rest) => {} | ^...

I didn't find this in the RFC but would be worth calling out: is the expectation that `$self:self` **must** be followed by either `,` or `)`?

Gonna block this on https://github.com/rust-lang/rust/issues/88583.

proc_macro::TokenStream is reference counted so I would not expect that wrapper to make a dramatic difference when using quote inside of a proc macro. Can you share commands I can...

`perf record` should work on macro expansion. https://gist.githubusercontent.com/dtolnay/5c5f4c403fa45d2b7d839e8d4b0497d9/raw/5328ec712bfe3e381f755a485cf667b7292b0b9a/winrt-flamegraph.svg I just ran `cargo check --verbose` to grab the last rustc invocation and ran `flamegraph rustc ...`.

I think the flamegraph is a good direction for what to optimize. I am not able to dedicate more time to this right now but I would accept perf fixes...

I would prefer not to put that in quote. I would be concerned of people using it unjustified (in procedural macros where the spans do matter and not having measured...

OTOH I would accept a fix in proc-macro2 + quote which defers instantiation of libproc_macro objects, which would give just about all the performance benefit without harming diagnostics or developer...

Yes exactly. That means that in main/build.rs use cases (as opposed to procedural macros) with no existing spanned tokens coming in from the macro input, *everything* would end up being...

I've put up https://github.com/dtolnay/proc-macro2/pull/320 with a draft of what I had in mind.