mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
Auto merge of #47690 - estebank:for-block-277, r=nikomatsakis
For E0277 on `for` loops, point at the "head" expression When E0277's span points at a `for` loop, the actual issue is in the element being iterated. Instead of pointing at the entire loop, point only at the first line (when possible) so that the span ends in the element for which E0277 was triggered.
This commit is contained in:
@@ -767,6 +767,7 @@ fn fix_multispan_in_std_macros(&mut self,
|
||||
}
|
||||
// Check to make sure we're not in any <*macros>
|
||||
if !cm.span_to_filename(def_site).is_macros() &&
|
||||
!trace.macro_decl_name.starts_with("desugaring of ") &&
|
||||
!trace.macro_decl_name.starts_with("#[") ||
|
||||
always_backtrace {
|
||||
new_labels.push((trace.call_site,
|
||||
|
||||
Reference in New Issue
Block a user