`std::ascii::escape_default` unexpectedly prints in LowerHex even though documentation specifies UpperHex
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
println!("{}", std::ascii::escape_default(0xFF));
As per the documentation for std::ascii::escape_default:
Any other chars are given hex escapes of the form
\xNN.
I expected it to print "\xFF", but instead it printed "\xff".
See Playground
Meta
rustc --version --verbose:
1.93.0
same issue in beta and nightly channels obviously.
I couldn't find whether this has been reported previously. Can someone confirm whether this is a bug or outdated documentation? If so, I will prepare a PR to fix it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with std::ascii::escape_default and the linked standard-library documentation, then reproduce the output with the provided snippet or Playground. Determine whether the implementation or documentation defines the intended hex casing; done means the behavior and documentation agree, with an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100