about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/errors.rs
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-07-10 03:23:52 -0400
committerGitHub <noreply@github.com>2025-07-10 03:23:52 -0400
commit73d3adc67b700ab3a41c72791f0ca5cbaef51425 (patch)
tree2fc0cd3e73a35a0e7be90348102291b76fc6a801 /compiler/rustc_interface/src/errors.rs
parent32cd9114712a24010b0583624dc52ac302194128 (diff)
parent6d1e93d8cdea975303397d91f726c40f5a7396fd (diff)
downloadrust-73d3adc67b700ab3a41c72791f0ca5cbaef51425.tar.gz
rust-73d3adc67b700ab3a41c72791f0ca5cbaef51425.zip
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).
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions