about 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-27 08:23:06 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-27 08:23:06 +0000
commit99a9a63ca6086338a3208b26b224f894d5a29d58 (patch)
treeeecf83c3c0ad7ee96208b74dd33feec53af0750f /compiler/rustc_const_eval/src/util
parent52bdc37727c03e1acf164c4fb44291c0921cb2d9 (diff)
downloadrust-99a9a63ca6086338a3208b26b224f894d5a29d58.tar.gz
rust-99a9a63ca6086338a3208b26b224f894d5a29d58.zip
Turns out opaque types can have hidden types registered during mir validation
Diffstat (limited to 'compiler/rustc_const_eval/src/util')
-rw-r--r--compiler/rustc_const_eval/src/util/compare_types.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_const_eval/src/util/compare_types.rs b/compiler/rustc_const_eval/src/util/compare_types.rs
index 88d4f5e715c..83376c8e992 100644
--- a/compiler/rustc_const_eval/src/util/compare_types.rs
+++ b/compiler/rustc_const_eval/src/util/compare_types.rs
@@ -57,12 +57,15 @@ pub fn is_subtype<'tcx>(
     // we would get unification errors because we're unable to look into opaque types,
     // even if they're constrained in our current function.
     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
-        );
+        let hidden_ty = tcx.type_of(key.def_id).instantiate(tcx, key.args);
+        if hidden_ty != ty.hidden_type.ty {
+            span_bug!(
+                ty.hidden_type.span,
+                "{}, {}",
+                tcx.type_of(key.def_id).instantiate(tcx, key.args),
+                ty.hidden_type.ty
+            );
+        }
     }
     errors.is_empty()
 }