summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/util
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-20 09:36:02 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-21 13:19:36 +0000
commit44e21503a8f2e789bbd90b5dd52590879ba2fab6 (patch)
tree8fbf3132a87eaeec5b90278e5747e22493378bed /compiler/rustc_const_eval/src/util
parentc67cb3e577bdd4de640eb11d96cd5ef5afe0eb0b (diff)
downloadrust-44e21503a8f2e789bbd90b5dd52590879ba2fab6.tar.gz
rust-44e21503a8f2e789bbd90b5dd52590879ba2fab6.zip
Double check that hidden types match the expected hidden type
Diffstat (limited to 'compiler/rustc_const_eval/src/util')
-rw-r--r--compiler/rustc_const_eval/src/util/compare_types.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/util/compare_types.rs b/compiler/rustc_const_eval/src/util/compare_types.rs
index d6a2ffb7511..88d4f5e715c 100644
--- a/compiler/rustc_const_eval/src/util/compare_types.rs
+++ b/compiler/rustc_const_eval/src/util/compare_types.rs
@@ -56,8 +56,13 @@ pub fn is_subtype<'tcx>(
     // With `Reveal::All`, opaque types get normalized away, with `Reveal::UserFacing`
     // we would get unification errors because we're unable to look into opaque types,
     // even if they're constrained in our current function.
-    //
-    // It seems very unlikely that this hides any bugs.
-    let _ = infcx.take_opaque_types();
+    for (key, ty) in infcx.take_opaque_types() {
+        span_bug!(
+            ty.hidden_type.span,
+            "{}, {}",
+            tcx.type_of(key.def_id).instantiate(tcx, key.args),
+            ty.hidden_type.ty
+        );
+    }
     errors.is_empty()
 }