Stabilize proc_macro_value feature#151973
Open
GuillaumeGomez wants to merge 1 commit into
Open
Conversation
Member
|
r? @dtolnay |
Member
|
I'm not sure if we should be stabilizing this without at least a sketch for the the integer value API, but I'm not the best person to determine this since I haven't used the proc macro API much. |
traviscross
reviewed
May 31, 2026
Comment on lines
+55
to
56
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub use rustc_literal_escaper::EscapeError; |
Contributor
There was a problem hiding this comment.
Do we want to make this enum non_exhaustive (it's not currently) before we stabilize the reexport?
Comment on lines
+67
to
69
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| #[derive(Debug, PartialEq, Eq)] | ||
| pub enum ConversionErrorKind { |
Contributor
There was a problem hiding this comment.
Do we want to make this non_exhaustive before stabilizing it?
Comment on lines
+1457
to
1460
| #[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn byte_character_value(&self) -> Result<u8, ConversionErrorKind> { | ||
| self.0.symbol.with(|symbol| match self.0.kind { | ||
| bridge::LitKind::Char => { |
Contributor
There was a problem hiding this comment.
Before we stabilize, do we mean to match on Char here or Byte? Currently byte_character(b'A').byte_character_value() leads to Err(InvalidLiteralKind).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #136652.
The feature implementation is complete: all string related values now have their
_valuemethod andproc_macro2integration seems to be working as expected.Integers are voluntarily left untouched as an equivalent API for them is much trickier to provide. I'll open an ACP once I come up with a design I'm happy with.
r? @Amanieu