-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
rustc_parse_format: improve error for missing : before ? in format args
#150765
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: main
Are you sure you want to change the base?
Conversation
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
|
r? @estebank |
|
This pr serves as an efforts toward issues 145718. Following up with our conversation @estebank, I was working on the issue but, I saw this and I thought on working on it while i can keep working on other part of the issue. If you have a Someone will get this error But, I believe, missing colon My proposed improvement was to sort of combine the current diagnostic error with the missing colon. After this pr, this is what will be output which I believe is a better diagnostic. I am also thinking having only |
: before ? in forma…: before ? in format args
7a1cc05 to
6135f34
Compare
|
Thanks for the review @estebank, made the requested change. |
…t args
Detect the `{ident?}` pattern where `?` is immediately followed by `}` and emit
a clearer diagnostic explaining that `:` is required for Debug formatting.
This avoids falling back to a generic “invalid format string” error and adds
a targeted UI test for the case.
Signed-off-by: Usman Akinyemi <[email protected]>
6135f34 to
b0e65da
Compare
|
@bors r+ |
rustc_parse_format: improve error for missing `:` before `?` in format args
Detect the `{ident?}` pattern where `?` is immediately followed by `}` and emit a clearer diagnostic explaining that `:` is required for Debug formatting. This avoids falling back to a generic “invalid format string” error and adds a targeted UI test for the case.
rustc_parse_format: improve error for missing `:` before `?` in format args
Detect the `{ident?}` pattern where `?` is immediately followed by `}` and emit a clearer diagnostic explaining that `:` is required for Debug formatting. This avoids falling back to a generic “invalid format string” error and adds a targeted UI test for the case.
rustc_parse_format: improve error for missing `:` before `?` in format args
Detect the `{ident?}` pattern where `?` is immediately followed by `}` and emit a clearer diagnostic explaining that `:` is required for Debug formatting. This avoids falling back to a generic “invalid format string” error and adds a targeted UI test for the case.
Detect the
{ident?}pattern where?is immediately followed by}and emit a clearer diagnostic explaining that:is required for Debug formatting. This avoids falling back to a generic “invalid format string” error and adds a targeted UI test for the case.