about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-09-14 17:24:18 +0000
committerMichael Goulet <michael@errs.io>2023-09-15 05:11:16 +0000
commit280f05856071ff33c472db10631f4e228ce0062d (patch)
tree00ececc10171a8a7986fe54e919a01e33fdb2ef7 /compiler/rustc_trait_selection/src/solve
parentae9465fee3962c0c895959001302999bc48ba6d5 (diff)
Canonicalize effect vars in new solver
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
-rw-r--r--compiler/rustc_trait_selection/src/solve/canonicalize.rs12
-rw-r--r--compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs11
2 files changed, 21 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/canonicalize.rs b/compiler/rustc_trait_selection/src/solve/canonicalize.rs
index 77c0f9f090c..f5901057a9d 100644
--- a/compiler/rustc_trait_selection/src/solve/canonicalize.rs
+++ b/compiler/rustc_trait_selection/src/solve/canonicalize.rs
@@ -365,8 +365,16 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
                 // FIXME: we should fold this ty eventually
                 CanonicalVarKind::Const(ui, c.ty())
             }
-            ty::ConstKind::Infer(ty::InferConst::EffectVar(_)) => {
-                bug!("effect var has no universe")
+            ty::ConstKind::Infer(ty::InferConst::EffectVar(vid)) => {
+                assert_eq!(
+                    self.infcx.root_effect_var(vid),
+                    vid,
+                    "effect var should have been resolved"
+                );
+                let None = self.infcx.probe_effect_var(vid) else {
+                    bug!("effect var should have been resolved");
+                };
+                CanonicalVarKind::Effect
             }
             ty::ConstKind::Infer(ty::InferConst::Fresh(_)) => {
                 bug!("fresh var during canonicalization: {c:?}")
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
index 523841951b0..790f9b840f2 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
@@ -382,6 +382,17 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EagerResolver<'_, 'tcx> {
                     }
                 }
             }
+            ty::ConstKind::Infer(ty::InferConst::EffectVar(vid)) => {
+                debug_assert_eq!(c.ty(), self.infcx.tcx.types.bool);
+                match self.infcx.probe_effect_var(vid) {
+                    Some(c) => c.as_const(self.infcx.tcx),
+                    None => ty::Const::new_infer(
+                        self.infcx.tcx,
+                        ty::InferConst::EffectVar(self.infcx.root_effect_var(vid)),
+                        self.infcx.tcx.types.bool,
+                    ),
+                }
+            }
             _ => {
                 if c.has_infer() {
                     c.super_fold_with(self)