Skip to content

Conversation

@GuillaumeGomez
Copy link
Member

Part of #136652.

It adds two more methods to get unescaped u8 and char from proc_macro::Literal.

r? @Amanieu

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 23, 2026

/// Returns the unescaped char value if the current literal is a char.
#[unstable(feature = "proc_macro_value", issue = "136652")]
pub fn char_value(&self) -> Result<char, ConversionErrorKind> {
Copy link
Member

Choose a reason for hiding this comment

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

The name should be consistent with the corresponding constructor.

Suggested change
pub fn char_value(&self) -> Result<char, ConversionErrorKind> {
pub fn character_value(&self) -> Result<char, ConversionErrorKind> {


/// Returns the unescaped char value if the current literal is a char.
#[unstable(feature = "proc_macro_value", issue = "136652")]
pub fn byte_value(&self) -> Result<u8, ConversionErrorKind> {
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Suggested change
pub fn byte_value(&self) -> Result<u8, ConversionErrorKind> {
pub fn byte_character_value(&self) -> Result<u8, ConversionErrorKind> {

})
}

/// Returns the unescaped char value if the current literal is a char.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Returns the unescaped char value if the current literal is a char.
/// Returns the unescaped character value if the current literal is a byte character literal.

})
}

/// Returns the unescaped char value if the current literal is a char.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Returns the unescaped char value if the current literal is a char.
/// Returns the unescaped character value if the current literal is a character literal.

@Amanieu
Copy link
Member

Amanieu commented Feb 1, 2026

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 1, 2026

📌 Commit 55e3d22 has been approved by Amanieu

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 1, 2026
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 1, 2026
…eral-methods, r=Amanieu

Add new `byte_value` and `char_value` methods to `proc_macro::Literal`

Part of rust-lang#136652.

It adds two more methods to get unescaped `u8` and `char` from `proc_macro::Literal`.

r? @Amanieu
rust-bors bot pushed a commit that referenced this pull request Feb 1, 2026
Rollup of 3 pull requests

Successful merges:

 - #151543 (Add new `byte_value` and `char_value` methods to `proc_macro::Literal`)
 - #151568 (Update hexagon target linker configurations)
 - #151725 (Fix outdated Debian Ports ISO reference)
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 1, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 1, 2026

☀️ Test successful - CI
Approved by: Amanieu
Duration: 3h 9m 59s
Pushing 8340622 to main...

@rust-bors rust-bors bot merged commit 8340622 into rust-lang:main Feb 1, 2026
12 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 1, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing b7fb220 (parent) -> 8340622 (this PR)

Test differences

Show 1 test diff

1 doctest diff were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 8340622e14324d0090a6edf42fce44fea3d7824f --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. pr-check-1: 1957.7s -> 1645.8s (-15.9%)
  2. aarch64-gnu-llvm-20-1: 3917.5s -> 3300.1s (-15.8%)
  3. i686-gnu-2: 6003.7s -> 5092.9s (-15.2%)
  4. x86_64-msvc-1: 8357.8s -> 9568.4s (+14.5%)
  5. x86_64-gnu-aux: 8361.1s -> 7185.8s (-14.1%)
  6. dist-aarch64-apple: 7066.9s -> 6182.7s (-12.5%)
  7. x86_64-msvc-ext1: 8316.2s -> 7304.3s (-12.2%)
  8. i686-gnu-nopt-1: 8143.4s -> 7174.1s (-11.9%)
  9. x86_64-gnu-tools: 3756.8s -> 3320.6s (-11.6%)
  10. x86_64-rust-for-linux: 2907.5s -> 2573.5s (-11.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8340622): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-4.6%, -2.3%] 3
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.1%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.1%] 22
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.1%] 22

Bootstrap: 478.155s -> 472.577s (-1.17%)
Artifact size: 397.82 MiB -> 397.87 MiB (0.01%)

@GuillaumeGomez GuillaumeGomez deleted the more-proc-macro-literal-methods branch February 2, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants