diff options
Diffstat (limited to 'crates/hir/src')
-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 | ||