about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-27 08:04:12 +0000
committerbors <bors@rust-lang.org>2018-01-27 08:04:12 +0000
commit6272b60dcaae2e69c991fc64cfb2e403c8a616a3 (patch)
treec07e40f847e804b187a35aa2b36ca94faffd92da /src/librustc_errors
parent5c41fcec4cd6e76180edb088a48914aa71612e5d (diff)
parent106e5c554d6b6b97aecac254a2694247e84e718e (diff)
downloadrust-6272b60dcaae2e69c991fc64cfb2e403c8a616a3.tar.gz
rust-6272b60dcaae2e69c991fc64cfb2e403c8a616a3.zip
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.
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 58f851aea38..8a4fd24a29b 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -767,6 +767,7 @@ impl EmitterWriter {
                         }
                         // 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,