Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #22135 from ChayimFriedman2/mono-infer
fix: Suppress infer vars in monomorphization
Shoyu Vanilla (Flint) 4 weeks ago
parent a74a2d9 · parent 74650c9 · commit 4295875
-rw-r--r--crates/hir-ty/src/mir/monomorphization.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir/monomorphization.rs b/crates/hir-ty/src/mir/monomorphization.rs
index 41044f00c2..dfce8ca2a5 100644
--- a/crates/hir-ty/src/mir/monomorphization.rs
+++ b/crates/hir-ty/src/mir/monomorphization.rs
@@ -65,6 +65,9 @@ impl<'db> FallibleTypeFolder<DbInterner<'db>> for Filler<'db> {
ty,
)
.map_err(|_| MirLowerError::NotSupported("can't normalize alias".to_owned()))?;
+ // Normalization could introduce infer vars (for example, if the alias cannot be normalized),
+ // and we must not have infer vars in the body.
+ let ty = ty.replace_infer_with_error(self.infcx.interner);
ty.try_super_fold_with(self)
}
TyKind::Param(param) => Ok(self