rust/library/proc_macro/src
Trevor Gross 73d3adc67b
Rollup merge of #141996 - Daniel-Aaron-Bloom:dollar_crate, r=petrochenkov
Fix `proc_macro::Ident`'s handling of `$crate`

This PR is addresses a few minor bugs, all relating to `proc_macro::Ident`'s support for `$crate`. `Ident` currently supports `$crate` (as can be seen in the `mixed-site-span` test), but:
* `proc_macro::Symbol::can_be_raw` is out of sync with `rustc_span::Symbol::can_be_raw`
  * former doesn't cover `$crate` while the latter does cover `kw::DollarCrate`
* `Ident::new` rejects `$crate`
  * This conflicts with the [reference definition](https://doc.rust-lang.org/nightly/reference/macros-by-example.html#r-macro.decl.meta.specifier) of `ident` which includes `$crate`.
  * This also conflicts with the documentation on [`Display for Ident`](https://doc.rust-lang.org/proc_macro/struct.Ident.html#impl-Display-for-Ident) which says the output "should be losslessly convertible back into the same identifier".

This PR fixes the above issues and extends the `mixed-site-span` test to exercise these fixed code paths, as well as validating the different possible spans resolve `$crate`  as expected (for both the new and old `$crate` construction code paths).
2025-07-10 03:23:52 -04:00
..
bridge Rollup merge of #141996 - Daniel-Aaron-Bloom:dollar_crate, r=petrochenkov 2025-07-10 03:23:52 -04:00
diagnostic.rs proc_macro/bridge: send diagnostics over the bridge as a struct 2022-08-06 15:49:43 -04:00
escape.rs Remove superfluous escaping from byte, byte str, and c str literals 2024-06-13 09:49:15 -07:00
lib.rs Auto merge of #140999 - hkBst:update-escaper, r=nnethercote 2025-06-25 01:03:30 +00:00
quote.rs Add support for repetition to proc_macro::quote 2025-06-17 01:36:54 +09:00
to_tokens.rs Add a new trait proc_macro::ToTokens 2024-10-27 03:17:05 +01:00