Unuseful span in type error in some format_args!() invocations #140578
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-fmt
Area: `core::fmt`
D-imprecise-spans
Diagnostics: spans don't point to exactly the erroneous code
E-help-wanted
Call for participation: Help is requested to fix this issue.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The span of this error is useful:
However, in a slightly more complicated println, the same error points at the entire macro invocation:
It should have just pointed at
[]
(or perhaps{:?}
), rather than the entire macro call.The simple println results in this case in format_args lowering:
rust/compiler/rustc_ast_lowering/src/format.rs
Lines 513 to 520 in cb0d6e7
The more complicated println results in this case in format_args lowering:
rust/compiler/rustc_ast_lowering/src/format.rs
Lines 538 to 547 in cb0d6e7
It'd be nice if both cases would cause any type/trait errors to be reported on the argument (or placeholders), instead of on the span of the entire macro invocation.
I'm not sure if this requires changes in rustc_ast_lowering, or in the code that reports the type errors.
The text was updated successfully, but these errors were encountered: