about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-15 02:25:15 +0100
committerGitHub <noreply@github.com>2022-01-15 02:25:15 +0100
commit8df08e8bce9d9baad0aa1e1d262f10e6609e683a (patch)
tree09aca810af0f3a706827cccff519b7a81a3d7be0
parent1d9ab77eb75b4fa71883831ce883ce8ff508bda1 (diff)
parentf6f814957796a8d2f1e9fe143652c870805d40ea (diff)
downloadrust-8df08e8bce9d9baad0aa1e1d262f10e6609e683a.tar.gz
rust-8df08e8bce9d9baad0aa1e1d262f10e6609e683a.zip
Rollup merge of #92625 - inquisitivecrystal:mirbug-caller, r=michaelwoerister
Add `#[track_caller]` to `mirbug`

When a "'no errors encountered even though `delay_span_bug` issued" error results from the `mirbug` function, the file location information points to the `mirbug` function itself, rather than its caller. This doesn't make sense, since the caller is the real source of the bug. Adding `#[track_caller]` will produce diagnostics that are more useful to anyone fixing the ICE.
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 1f745f977d4..87b0a887d1c 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -312,6 +312,7 @@ fn translate_outlives_facts(typeck: &mut TypeChecker<'_, '_>) {
     }
 }
 
+#[track_caller]
 fn mirbug(tcx: TyCtxt<'_>, span: Span, msg: &str) {
     // We sometimes see MIR failures (notably predicate failures) due to
     // the fact that we check rvalue sized predicates here. So use `delay_span_bug`