Tracking issue for `proc_macro_value`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(proc_macro_value)]
This feature provides methods on proc_macro::Literal to get their unescaped string equivalent.
Public API
For now, the only choice to get these values is to either copy-paste rustc's source code or use syn which has more or less the same code to achieve the same result.
After this change, one will be able to do:
// The one provided by `proc-macro`.
let literal_string = Literal::String { .. };
let unescaped_string_literal = literal_string.str_value().expect("failed to unescape");
Steps / History
- ACP
- Implementation
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- Tests and/or shared code demonstrating that the new API parses the same set of (no more, no less) inputs with the same outputs as rustc would (cc https://github.com/rust-lang/rust/pull/154608#discussion_r3344111522).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proc_macro::Literal API described in the issue and review the implementation history, especially the linked discussion about parsing behavior. Add tests or shared code showing that the new API accepts exactly the same inputs and produces the same outputs as rustc, then verify the remaining FCP and stabilization steps are satisfied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100