about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-03 16:32:34 +0000
committerbors <bors@rust-lang.org>2020-11-03 16:32:34 +0000
commit5cdf5b882da9e8b7c73b5cadeb7745cb68f6ff63 (patch)
treeaad7be87cf61929657d4eb3775ae0e9534c0691e /compiler/rustc_errors/src
parent0cd1516696550e108863bf4b4fb81ce5c4f58968 (diff)
parent888ef24c2295fc3a1e96f864376fb22b00cc5583 (diff)
downloadrust-5cdf5b882da9e8b7c73b5cadeb7745cb68f6ff63.tar.gz
rust-5cdf5b882da9e8b7c73b5cadeb7745cb68f6ff63.zip
Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiser
Properly handle lint spans after MIR inlining

The first commit shows what happens when we apply mir inlining and then cause lints on the inlined MIR.
The second commit fixes that.

r? `@wesleywiser`
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/emitter.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 2dc7b7e2da3..302713a21db 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -299,7 +299,7 @@ pub trait Emitter {
 
                     // Skip past non-macro entries, just in case there
                     // are some which do actually involve macros.
-                    ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None,
+                    ExpnKind::Inlined | ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None,
 
                     ExpnKind::Macro(macro_kind, _) => Some(macro_kind),
                 }
@@ -359,7 +359,10 @@ pub trait Emitter {
                     continue;
                 }
 
-                if always_backtrace {
+                if matches!(trace.kind, ExpnKind::Inlined) {
+                    new_labels
+                        .push((trace.call_site, "in the inlined copy of this code".to_string()));
+                } else if always_backtrace {
                     new_labels.push((
                         trace.def_site,
                         format!(