-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
rustc_parse_format: improve diagnostics for unsupported python numeric grouping #150941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
|
r? @estebank |
|
Hello as part of the ongoing effort in #145718 initially, the compiler gives the below error for the above but after this changes, it gives a better error message suggesting the compiler understand that is a python-style numeric grouping, but it is not supported in rust. |
|
☔ The latest upstream changes (presumably #150912) made this pull request unmergeable. Please resolve the merge conflicts. |
ed2a482 to
44acb6d
Compare
That seems like a very weird place for a very verbose error text to be. Things in that position are usually indicative of what they are pointing at, as opposed to commenting on whether it's correct or not and how. (or at least they are much more terse when they do) |
…c grouping
Detect Python-style numeric grouping syntax in format strings (e.g. `{x:,}`)
and emit a clear diagnostic explaining that it is not supported in Rust.
This helps users coming from Python understand the error without exposing
the full set of valid Rust format specifiers.
Signed-off-by: Usman Akinyemi <[email protected]>
|
Thank you very much for the review @workingjubilee |
44acb6d to
76ad528
Compare
|
I'm not aware of a digit grouping format string specifier, so it seems there is no meaningful suggestion to offer instead aside from recommending a random crate, and this seems an adequate improvement. Thank you. @bors r+ rollup |
|
Thanks for the review @workingjubilee |
rustc_parse_format: improve diagnostics for unsupported python numeric grouping
Detect Python-style numeric grouping syntax in format strings (e.g. `{x:,}`)
and emit a clear diagnostic explaining that it is not supported in Rust.
This helps users coming from Python understand the error without exposing
the full set of valid Rust format specifiers.
Rollup of 5 pull requests Successful merges: - #150861 (Folding/`ReErased` cleanups) - #150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping) - #150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items)) - #150980 (Use updated indexes to build reverse map for delegation generics) - #150986 (std: Fix size returned by UEFI tcp4 read operations) r? @ghost
Rollup of 8 pull requests Successful merges: - #150861 (Folding/`ReErased` cleanups) - #150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple) - #150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`) - #150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping) - #150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items)) - #150980 (Use updated indexes to build reverse map for delegation generics) - #150986 (std: Fix size returned by UEFI tcp4 read operations) - #150996 (Remove `S-waiting-on-bors` after a PR is merged) r? @ghost
Rollup of 8 pull requests Successful merges: - #150861 (Folding/`ReErased` cleanups) - #150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple) - #150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`) - #150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping) - #150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items)) - #150980 (Use updated indexes to build reverse map for delegation generics) - #150986 (std: Fix size returned by UEFI tcp4 read operations) - #150996 (Remove `S-waiting-on-bors` after a PR is merged) r? @ghost
Rollup merge of #150941 - ua/numeric, r=workingjubilee rustc_parse_format: improve diagnostics for unsupported python numeric grouping Detect Python-style numeric grouping syntax in format strings (e.g. `{x:,}`) and emit a clear diagnostic explaining that it is not supported in Rust. This helps users coming from Python understand the error without exposing the full set of valid Rust format specifiers.
Detect Python-style numeric grouping syntax in format strings (e.g.
{x:,})and emit a clear diagnostic explaining that it is not supported in Rust.
This helps users coming from Python understand the error without exposing
the full set of valid Rust format specifiers.