Add _value API for number literals in proc-macro#154608
Add _value API for number literals in proc-macro#154608GuillaumeGomez wants to merge 2 commits intorust-lang:mainfrom
_value API for number literals in proc-macro#154608Conversation
This comment has been minimized.
This comment has been minimized.
ae03536 to
7cb03fd
Compare
|
My favourite kind of failure: works locally but not in CI. T_T Updated the value in the tests to see which one exactly is failing. |
This comment has been minimized.
This comment has been minimized.
7cb03fd to
c755b56
Compare
|
Bug comes from an issue with GCC proc-macro ABI. Ignoring this test on GCC backend for now. |
|
CI fixed. :) |
|
A libs (or maybe even libs-api) reviewer seems more appropriate to review this PR. r? Amanieu (since you reviewed #136355) |
|
I missed it already has an accepted ACP. The PR can be reviewed by libs reviewer. r? libs |
|
|
||
| float_values! { | ||
| // FIXME: To be uncommented when `f16` is stable. | ||
| // f16 => f16_value, |
There was a problem hiding this comment.
Shouldn't this be available, but unstable?
| Hexadecimal = 16, | ||
| } | ||
|
|
||
| fn parse_number(value: &str) -> (String, Base) { |
There was a problem hiding this comment.
Is this exactly in sync with what the rustc parser permits?
I guess that would be a mix of https://doc.rust-lang.org/nightly/reference/tokens.html#grammar-INTEGER_LITERAL and whatever we then tokenize from it?
Perhaps this should go over the bridge and ask rustc to parse the string for us?
| (output, base) | ||
| } | ||
|
|
||
| fn only_digits(value_s: &str) -> Cow<'_, str> { |
There was a problem hiding this comment.
This isn't really only_digits... it's more like "not _"?
Part of #136652.
This PR adds the
*_valuefor numbers (integers and floats). However,f16andf128are voluntarily left out as they're still unstable. Adding support for them is just a matter of uncommenting two lines, so should be fine.Setting same reviewer as last time.
r? @Urgau