aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs14
-rw-r--r--crates/ra_hir/src/source_analyzer.rs3
2 files changed, 9 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 837a3ed6d..fda31d517 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -733,8 +733,7 @@ impl Local {
733 let ty = infer[self.pat_id].clone(); 733 let ty = infer[self.pat_id].clone();
734 let resolver = def.resolver(db); 734 let resolver = def.resolver(db);
735 let krate = def.module(db).krate; 735 let krate = def.module(db).krate;
736 let ctx = hir_ty::TyLoweringContext { db, resolver: &resolver }; 736 let environment = TraitEnvironment::lower(db, &resolver);
737 let environment = TraitEnvironment::lower(&ctx);
738 Type { krate, ty: InEnvironment { value: ty, environment } } 737 Type { krate, ty: InEnvironment { value: ty, environment } }
739 } 738 }
740 739
@@ -790,8 +789,12 @@ impl ImplBlock {
790 pub fn target_ty(&self, db: &impl HirDatabase) -> Type { 789 pub fn target_ty(&self, db: &impl HirDatabase) -> Type {
791 let impl_data = db.impl_data(self.id); 790 let impl_data = db.impl_data(self.id);
792 let resolver = self.id.resolver(db); 791 let resolver = self.id.resolver(db);
793 let ctx = hir_ty::TyLoweringContext { db, resolver: &resolver }; 792 let ctx = hir_ty::TyLoweringContext {
794 let environment = TraitEnvironment::lower(&ctx); 793 db,
794 resolver: &resolver,
795 impl_trait_mode: hir_ty::ImplTraitLoweringMode::Disallowed,
796 };
797 let environment = TraitEnvironment::lower(db, &resolver);
795 let ty = Ty::from_hir(&ctx, &impl_data.target_type); 798 let ty = Ty::from_hir(&ctx, &impl_data.target_type);
796 Type { 799 Type {
797 krate: self.id.lookup(db).container.module(db).krate, 800 krate: self.id.lookup(db).container.module(db).krate,
@@ -846,8 +849,7 @@ pub struct Type {
846impl Type { 849impl Type {
847 fn new(db: &impl HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type { 850 fn new(db: &impl HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type {
848 let resolver = lexical_env.resolver(db); 851 let resolver = lexical_env.resolver(db);
849 let ctx = hir_ty::TyLoweringContext { db, resolver: &resolver }; 852 let environment = TraitEnvironment::lower(db, &resolver);
850 let environment = TraitEnvironment::lower(&ctx);
851 Type { krate, ty: InEnvironment { value: ty, environment } } 853 Type { krate, ty: InEnvironment { value: ty, environment } }
852 } 854 }
853 855
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index 9cfd52856..bb9a35c5d 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -179,8 +179,7 @@ impl SourceAnalyzer {
179 } 179 }
180 180
181 fn trait_env(&self, db: &impl HirDatabase) -> Arc<TraitEnvironment> { 181 fn trait_env(&self, db: &impl HirDatabase) -> Arc<TraitEnvironment> {
182 let ctx = hir_ty::TyLoweringContext { db, resolver: &self.resolver }; 182 TraitEnvironment::lower(db, &self.resolver)
183 TraitEnvironment::lower(&ctx)
184 } 183 }
185 184
186 pub fn type_of(&self, db: &impl HirDatabase, expr: &ast::Expr) -> Option<Type> { 185 pub fn type_of(&self, db: &impl HirDatabase, expr: &ast::Expr) -> Option<Type> {