about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-04-04 09:27:44 -0700
committerGitHub <noreply@github.com>2023-04-04 09:27:44 -0700
commited17b599dfba4703040bcddb162c8e3419ab95bd (patch)
tree2060310a09f5bbf4247f63796941d798adf35e1b /compiler/rustc_codegen_ssa/src/mir
parent4d32de6fcbb2ab05e9aaa94477caa30d816f8f66 (diff)
parenta84909c1e78aef244385b46db080bf78ce548881 (diff)
downloadrust-ed17b599dfba4703040bcddb162c8e3419ab95bd.tar.gz
rust-ed17b599dfba4703040bcddb162c8e3419ab95bd.zip
Rollup merge of #109901 - cjgillot:validate-debuginfo, r=b-naber
Enforce VarDebugInfo::Place in MIR validation.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
-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 ff25d1e3823..280f0207116 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 },
+                )
+            }
         }
     }