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`
This commit is contained in:
bors
2020-11-03 16:32:34 +00:00
40 changed files with 400 additions and 350 deletions

View File

@@ -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!(