Canonicalize effect vars in new solver
This commit is contained in:
parent
ae9465fee3
commit
280f058560
4 changed files with 47 additions and 2 deletions
|
@ -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:?}")
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue