diff options
author | Florian Diebold <[email protected]> | 2021-05-16 14:50:28 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-05-21 16:48:34 +0100 |
commit | 1250ddc5cf58ff0a6bbf7c07e5bd9f7cc7db5a09 (patch) | |
tree | 51c6ed040c2b1ec6b33321501ced866d87701c71 /crates/hir | |
parent | a3d9cac69057db700c4f6e01b84dc59529ea6dfd (diff) |
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.
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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 { | |||
1712 | resolver: &Resolver, | 1712 | resolver: &Resolver, |
1713 | ty: Ty, | 1713 | ty: Ty, |
1714 | ) -> Type { | 1714 | ) -> Type { |
1715 | let environment = | 1715 | let environment = resolver |
1716 | resolver.generic_def().map_or_else(Default::default, |d| db.trait_environment(d)); | 1716 | .generic_def() |
1717 | .map_or_else(|| Arc::new(TraitEnvironment::empty(krate)), |d| db.trait_environment(d)); | ||
1717 | Type { krate, env: environment, ty } | 1718 | Type { krate, env: environment, ty } |
1718 | } | 1719 | } |
1719 | 1720 | ||
1720 | fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type { | 1721 | fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type { |
1721 | let resolver = lexical_env.resolver(db.upcast()); | 1722 | let resolver = lexical_env.resolver(db.upcast()); |
1722 | let environment = | 1723 | let environment = resolver |
1723 | resolver.generic_def().map_or_else(Default::default, |d| db.trait_environment(d)); | 1724 | .generic_def() |
1725 | .map_or_else(|| Arc::new(TraitEnvironment::empty(krate)), |d| db.trait_environment(d)); | ||
1724 | Type { krate, env: environment, ty } | 1726 | Type { krate, env: environment, ty } |
1725 | } | 1727 | } |
1726 | 1728 | ||