From 1250ddc5cf58ff0a6bbf7c07e5bd9f7cc7db5a09 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 16 May 2021 15:50:28 +0200 Subject: Rework obligation handling We can't do the easy hack that we did before anymore, where we kept track of whether any inference variables changed since the last time we rechecked obligations. Instead, we store the obligations in canonicalized form; that way we can easily check the inference variables to see whether they have changed since the goal was canonicalized. --- crates/hir/src/lib.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 1429384cb..52d72c3c5 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1712,15 +1712,17 @@ impl Type { resolver: &Resolver, ty: Ty, ) -> Type { - let environment = - resolver.generic_def().map_or_else(Default::default, |d| db.trait_environment(d)); + let environment = resolver + .generic_def() + .map_or_else(|| Arc::new(TraitEnvironment::empty(krate)), |d| db.trait_environment(d)); Type { krate, env: environment, ty } } fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type { let resolver = lexical_env.resolver(db.upcast()); - let environment = - resolver.generic_def().map_or_else(Default::default, |d| db.trait_environment(d)); + let environment = resolver + .generic_def() + .map_or_else(|| Arc::new(TraitEnvironment::empty(krate)), |d| db.trait_environment(d)); Type { krate, env: environment, ty } } -- cgit v1.2.3