-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Fix format string grammar in docs and improve alignment error message for #144023 #145592
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after updating PR description + squashing commits
Some changes occurred in src/tools/cargo cc @ehuss |
This comment has been minimized.
This comment has been minimized.
You've accidentally committed changes to submodules here; see the above comment added by |
Ah, got it 🙂. |
ba03ce2
to
440b820
Compare
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. |
Please also squash this PR/merge it all into 1 commit. It's not large enough for 6 commits 😁 what tend to use is git rebase -i --autosquash $(git merge-base HEAD origin/master) and then merge all relevant commits by changing them from |
440b820
to
fdbaaac
Compare
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.rs
to 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