Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for proc_macro_value #136652

Open
4 tasks
GuillaumeGomez opened this issue Feb 6, 2025 · 0 comments
Open
4 tasks

Tracking issue for proc_macro_value #136652

GuillaumeGomez opened this issue Feb 6, 2025 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@GuillaumeGomez
Copy link
Member

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

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@GuillaumeGomez GuillaumeGomez added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Feb 6, 2025
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 16, 2025
…retrieval_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang#136652.

r? libs-api
jhpratt added a commit to jhpratt/rust that referenced this issue Mar 16, 2025
…e_retrieval_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang#136652.

r? libs-api
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 16, 2025
…retrieval_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang#136652.

r? libs-api
jhpratt added a commit to jhpratt/rust that referenced this issue Mar 17, 2025
…e_retrieval_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang#136652.

r? libs-api
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 17, 2025
Rollup merge of rust-lang#136355 - GuillaumeGomez:proc-macro_add_value_retrieval_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang#136652.

r? libs-api
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Mar 20, 2025
…al_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang/rust#136652.

r? libs-api
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Mar 26, 2025
…e_retrieval_methods, r=Amanieu

Add `*_value` methods to proc_macro lib

This is the implementation of rust-lang/libs-team#459.

It allows to get the actual value (unescaped) of the different string literals.

Part of rust-lang#136652.

r? libs-api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant