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_ty/src/lower.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/hir_ty/src/lower.rs') diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index bd8bb6028..8a375b973 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -1035,9 +1035,11 @@ pub(crate) fn trait_environment_query( clauses.push(program_clause.into_from_env_clause(&Interner)); } + let krate = def.module(db.upcast()).krate(); + let env = chalk_ir::Environment::new(&Interner).add_clauses(&Interner, clauses); - Arc::new(TraitEnvironment { traits_from_clauses: traits_in_scope, env }) + Arc::new(TraitEnvironment { krate, traits_from_clauses: traits_in_scope, env }) } /// Resolve the where clause(s) of an item with generics. -- cgit v1.2.3