-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Fix format string grammar in docs and improve alignment error message #144023 #145512
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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: León Orell Valerian Liehr <[email protected]>
Co-authored-by: Lieselotte <[email protected]>
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
This PR improves error messages and documentation for format strings involving alignment and formatting traits.
Highlights:
Clearer error messages for invalid alignment specifiers (e.g.,
{0:#X>18}), showing the expected<,^, or>and a working example:println!("{0:>#18X}", value);
Updated UI test
format-alignment-hash.rsto reflect the improved error output.Documentation clarification: ensures examples correctly show how width, alignment, and traits like
x,X,#combine.Motivation:
Previously, using
#with alignment and width produced confusing errors. This PR guides users on the correct syntax and provides actionable examples.Testing:
./x build)./x. test src/test/ui/fmt/format-alignment-hash.rs --bless)./x test)Issue: #144023