close
Skip to content

Stabilize proc_macro_value feature#151973

Open
GuillaumeGomez wants to merge 1 commit into
rust-lang:mainfrom
GuillaumeGomez:stabilize-proc_macro_value
Open

Stabilize proc_macro_value feature#151973
GuillaumeGomez wants to merge 1 commit into
rust-lang:mainfrom
GuillaumeGomez:stabilize-proc_macro_value

Conversation

@GuillaumeGomez
Copy link
Copy Markdown
Member

Fixes #136652.

The feature implementation is complete: all string related values now have their _value method and proc_macro2 integration 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

@GuillaumeGomez GuillaumeGomez added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 2, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 2, 2026
@jhpratt jhpratt added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label Feb 2, 2026
@Amanieu
Copy link
Copy Markdown
Member

Amanieu commented Mar 28, 2026

r? @dtolnay

@rustbot rustbot assigned dtolnay and unassigned Amanieu Mar 28, 2026
@Amanieu
Copy link
Copy Markdown
Member

Amanieu commented Mar 28, 2026

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.

Comment on lines +55 to 56
#[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")]
pub use rustc_literal_escaper::EscapeError;
Copy link
Copy Markdown
Contributor

@traviscross traviscross May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make this enum non_exhaustive (it's not currently) before we stabilize the reexport?

View changes since the review

Comment on lines +67 to 69
#[stable(feature = "proc_macro_value", since = "CURRENT_RUSTC_VERSION")]
#[derive(Debug, PartialEq, Eq)]
pub enum ConversionErrorKind {
Copy link
Copy Markdown
Contributor

@traviscross traviscross May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make this non_exhaustive before stabilizing it?

View changes since the review

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 => {
Copy link
Copy Markdown
Contributor

@traviscross traviscross May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking issue for proc_macro_value

6 participants