rust-lang / rust-lang/rust

Tracking issue for `proc_macro_value`

Open
#136,652 7 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue T-libs
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
Unresolved Questions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.