rust/library/proc_macro/src/bridge
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
..
arena.rs manual clippy fixes 2025-05-12 15:33:41 +02:00
buffer.rs Revert "Add a hack to prevent proc_macro misopt in CI" 2024-09-18 13:53:33 -07:00
client.rs Replace proc_macro::SourceFile by Span::{file, local_file}. 2025-04-11 15:07:08 +02:00
closure.rs proc_macro: Apply unsafe_op_in_unsafe_fn 2025-02-14 07:36:17 -08:00
fxhash.rs proc_macro: add #![warn(unreachable_pub)] 2025-01-20 18:46:29 +01:00
handle.rs SeqCst->Relaxed for proc_macro bridge counter. 2024-03-19 15:27:11 +01:00
mod.rs Remove all support for wasm's legacy ABI 2025-06-14 09:57:06 +00:00
rpc.rs proc_macro: add #![warn(unreachable_pub)] 2025-01-20 18:46:29 +01:00
selfless_reify.rs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
server.rs Replace proc_macro::SourceFile by Span::{file, local_file}. 2025-04-11 15:07:08 +02:00
symbol.rs Add support for $crate to Ident 2025-06-12 01:13:24 -07:00