Valid underscores in hex/octal/binary literal docs#84017
Valid underscores in hex/octal/binary literal docs#84017bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @ollie27 (rust-highfive has picked a reviewer for you, use r? to override) |
pickfire
left a comment
There was a problem hiding this comment.
Looks good to me. But I wonder why the tests couldn't be kept in the same file?
|
@pickfire All of the other Rustdoc tests are also in their own |
|
r? @jyn514 |
jyn514
left a comment
There was a problem hiding this comment.
@pickfire All of the other Rustdoc tests are also in their own
testsmodule, so I added these tests using the same convention.
Yup, and this also avoids recompiling the main rustdoc crate when you only change a test.
This looks good to me, just a couple nits on the implementation :)
src/librustdoc/clean/utils.rs
Outdated
There was a problem hiding this comment.
A good follow-up would be to remove num_chars altogether - num is always ascii so you should be able to just use bytes directly. Doesn't need to be in this PR though :)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Do you mind squashing the commits into one? There are instructions at https://rustc-dev-guide.rust-lang.org/git.html#advanced-rebasing, or if it's a pain bors can do it automatically (it will just show the PR as closed instead of merged because github doesn't recognize it). |
Currently hex/octal/binary literals with computed values are displayed like `0_xff_fff_fffu32`, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers.
5be9752 to
f84b4c5
Compare
|
@bors r+ Thanks for working on this! |
|
📌 Commit f84b4c5 has been approved by |
|
🌲 The tree is currently closed for pull requests below priority 99. This pull request will be tested once the tree is reopened. |
…=jyn514 Valid underscores in hex/octal/binary literal docs Currently hex/octal/binary literals with computed values are displayed like `0_xff_fff_fffu32`, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers. This causes [`std::u32::MAX`](https://doc.rust-lang.org/std/u32/constant.MAX.html) to be displayed as ```rust pub const MAX: u32 = u32::MAX; // 0_xff_fff_fffu32 ``` This PR changes it to be displayed as: ```rust pub const MAX: u32 = u32::MAX; // 0xffff_ffffu32 ```
|
💥 Unable to create a status for d624549bf84ee7110771ff0b5fe2b63ebcc21e9a (422 No commit found for SHA: d624549bf84ee7110771ff0b5fe2b63ebcc21e9a) |
|
☀️ Test successful - checks-actions |
Currently hex/octal/binary literals with computed values are displayed like
0_xff_fff_fffu32, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers.This causes
std::u32::MAXto be displayed asThis PR changes it to be displayed as: