about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-01-14 22:23:49 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-04-03 17:44:12 +0000
commita84909c1e78aef244385b46db080bf78ce548881 (patch)
tree2c21eca796335944e31ecff2d92a1cad5c45d82e /compiler/rustc_codegen_ssa/src
parent86792086646b61342c9417b78b8a535392f1045f (diff)
downloadrust-a84909c1e78aef244385b46db080bf78ce548881.tar.gz
rust-a84909c1e78aef244385b46db080bf78ce548881.zip
Enforce VarDebugInfo::Place in MIR validation.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/debuginfo.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
index d15774696a5..8549abd6e39 100644
--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
@@ -165,11 +165,15 @@ fn calculate_debuginfo_offset<
             mir::ProjectionElem::Downcast(_, variant) => {
                 place = place.downcast(bx, variant);
             }
-            _ => span_bug!(
-                var.source_info.span,
-                "unsupported var debuginfo place `{:?}`",
-                mir::Place { local, projection: var.projection },
-            ),
+            _ => {
+                // Sanity check for `can_use_in_debuginfo`.
+                debug_assert!(!elem.can_use_in_debuginfo());
+                span_bug!(
+                    var.source_info.span,
+                    "unsupported var debuginfo place `{:?}`",
+                    mir::Place { local, projection: var.projection },
+                )
+            }
         }
     }