-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add DesugaringKind::FormatLiteral #142594
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
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
Some changes occurred in compiler/rustc_ast_lowering/src/format.rs cc @m-ou-se |
We might want to block this on #140748, I'm relatively sure. Just FYI |
Why is that? |
Idk, if it's not conflicting according to git and if it's not stepping on each other's toes in other ways, I guess it's fine — I only skimmed boths diffs. Mara's PR will likely get approved soon anyway. |
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.
Great, #141633 can be refactored after this.
compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
Show resolved
Hide resolved
@@ -50,6 +50,7 @@ pub struct FormatArgs { | |||
/// | |||
/// Generally only useful for lints that care about the raw bytes the user wrote. | |||
pub uncooked_fmt_str: (LitKind, Symbol), | |||
pub is_source_literal: bool, |
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.
Can you add a doc comment on this field to explain what it means?
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.
Done
Implements
DesugaringKind::FormatLiteral
to mark the FormatArgs desugaring of format literals. The main use for this is to stop yapping about about formatting parameters if we're not anywhere near a format literal. The other use case is to fix suggestions such as #141350. It might also be useful for new or existing diagnostics that check whether they're in a format-like macro.cc @xizheyin @fmease