aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 571b89bc3..cda050a7d 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -54,8 +54,8 @@ use hir_ty::{
54 method_resolution, to_assoc_type_id, 54 method_resolution, to_assoc_type_id,
55 traits::{FnTrait, Solution, SolutionVariables}, 55 traits::{FnTrait, Solution, SolutionVariables},
56 AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, 56 AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate,
57 InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, 57 InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, Ty,
58 TraitEnvironment, Ty, TyDefId, TyKind, TyVariableKind, 58 TyDefId, TyKind, TyVariableKind,
59}; 59};
60use rustc_hash::FxHashSet; 60use rustc_hash::FxHashSet;
61use stdx::{format_to, impl_from}; 61use stdx::{format_to, impl_from};
@@ -817,7 +817,7 @@ impl Function {
817 let resolver = self.id.resolver(db.upcast()); 817 let resolver = self.id.resolver(db.upcast());
818 let krate = self.id.lookup(db.upcast()).container.module(db.upcast()).krate(); 818 let krate = self.id.lookup(db.upcast()).container.module(db.upcast()).krate();
819 let ctx = hir_ty::TyLoweringContext::new(db, &resolver); 819 let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
820 let environment = TraitEnvironment::lower(db, &resolver); 820 let environment = db.trait_environment(self.id.into());
821 db.function_data(self.id) 821 db.function_data(self.id)
822 .params 822 .params
823 .iter() 823 .iter()
@@ -1563,13 +1563,15 @@ impl Type {
1563 resolver: &Resolver, 1563 resolver: &Resolver,
1564 ty: Ty, 1564 ty: Ty,
1565 ) -> Type { 1565 ) -> Type {
1566 let environment = TraitEnvironment::lower(db, &resolver); 1566 let environment =
1567 resolver.generic_def().map_or_else(Default::default, |d| db.trait_environment(d));
1567 Type { krate, ty: InEnvironment { value: ty, environment } } 1568 Type { krate, ty: InEnvironment { value: ty, environment } }
1568 } 1569 }
1569 1570
1570 fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type { 1571 fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type {
1571 let resolver = lexical_env.resolver(db.upcast()); 1572 let resolver = lexical_env.resolver(db.upcast());
1572 let environment = TraitEnvironment::lower(db, &resolver); 1573 let environment =
1574 resolver.generic_def().map_or_else(Default::default, |d| db.trait_environment(d));
1573 Type { krate, ty: InEnvironment { value: ty, environment } } 1575 Type { krate, ty: InEnvironment { value: ty, environment } }
1574 } 1576 }
1575 1577