From c8a866ea176f1d7250a714647a6ce7a4636f5705 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sat, 19 Sep 2020 18:56:32 +0200 Subject: Show the inline stack of MIR lints that only occur after inlining --- compiler/rustc_errors/src/emitter.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index b5155f8e910..1922dbef64d 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -296,7 +296,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), } @@ -356,7 +356,9 @@ 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".to_string())); + } else if always_backtrace { new_labels.push(( trace.def_site, format!( -- cgit 1.4.1-3-g733a5 From 888ef24c2295fc3a1e96f864376fb22b00cc5583 Mon Sep 17 00:00:00 2001 From: oli Date: Tue, 27 Oct 2020 14:16:23 +0000 Subject: Address review comment --- compiler/rustc_errors/src/emitter.rs | 3 ++- src/test/ui/const_prop/inline_spans.stderr | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 1922dbef64d..dda1e4c24ed 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -357,7 +357,8 @@ pub trait Emitter { } if matches!(trace.kind, ExpnKind::Inlined) { - new_labels.push((trace.call_site, "in the inlined copy of this".to_string())); + 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, diff --git a/src/test/ui/const_prop/inline_spans.stderr b/src/test/ui/const_prop/inline_spans.stderr index 05596b8dd3f..5a54967e0d0 100644 --- a/src/test/ui/const_prop/inline_spans.stderr +++ b/src/test/ui/const_prop/inline_spans.stderr @@ -5,7 +5,7 @@ LL | let _ = add(u8::MAX, 1); | ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow ... LL | x + y - | ----- in the inlined copy of this + | ----- in the inlined copy of this code | = note: `#[deny(arithmetic_overflow)]` on by default -- cgit 1.4.1-3-g733a5