diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-13 21:45:30 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-13 21:45:30 +0000 |
commit | f80e1080d3457a7932995d770658827a4dbc1f47 (patch) | |
tree | 2d70ac00f2228623ac012576bd881df3edc1c077 /crates/hir_ty/src/infer | |
parent | d3ca2ab959af672e779757dbcab755b61a4ec091 (diff) | |
parent | 3743ede404d38586db9d7febca14b8bebcbbe0ef (diff) |
Merge #8003
8003: Move type lowering methods to TyLoweringContext r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/path.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index c6681834c..af108fb6c 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs | |||
@@ -40,7 +40,7 @@ impl<'a> InferenceContext<'a> { | |||
40 | let ty = self.make_ty(type_ref); | 40 | let ty = self.make_ty(type_ref); |
41 | let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1); | 41 | let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1); |
42 | let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver); | 42 | let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver); |
43 | let (ty, _) = Ty::from_type_relative_path(&ctx, ty, None, remaining_segments_for_ty); | 43 | let (ty, _) = ctx.lower_ty_relative_path(ty, None, remaining_segments_for_ty); |
44 | self.resolve_ty_assoc_item( | 44 | self.resolve_ty_assoc_item( |
45 | ty, | 45 | ty, |
46 | &path.segments().last().expect("path had at least one segment").name, | 46 | &path.segments().last().expect("path had at least one segment").name, |
@@ -96,7 +96,7 @@ impl<'a> InferenceContext<'a> { | |||
96 | // self_subst is just for the parent | 96 | // self_subst is just for the parent |
97 | let parent_substs = self_subst.unwrap_or_else(Substs::empty); | 97 | let parent_substs = self_subst.unwrap_or_else(Substs::empty); |
98 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); | 98 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); |
99 | let substs = Ty::substs_from_path(&ctx, path, typable, true); | 99 | let substs = ctx.substs_from_path(path, typable, true); |
100 | let full_substs = Substs::builder(substs.len()) | 100 | let full_substs = Substs::builder(substs.len()) |
101 | .use_parent_substs(&parent_substs) | 101 | .use_parent_substs(&parent_substs) |
102 | .fill(substs.0[parent_substs.len()..].iter().cloned()) | 102 | .fill(substs.0[parent_substs.len()..].iter().cloned()) |
@@ -126,7 +126,8 @@ impl<'a> InferenceContext<'a> { | |||
126 | let segment = | 126 | let segment = |
127 | remaining_segments.last().expect("there should be at least one segment here"); | 127 | remaining_segments.last().expect("there should be at least one segment here"); |
128 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); | 128 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); |
129 | let trait_ref = TraitRef::from_resolved_path(&ctx, trait_, resolved_segment, None); | 129 | let trait_ref = |
130 | ctx.lower_trait_ref_from_resolved_path(trait_, resolved_segment, None); | ||
130 | self.resolve_trait_assoc_item(trait_ref, segment, id) | 131 | self.resolve_trait_assoc_item(trait_ref, segment, id) |
131 | } | 132 | } |
132 | (def, _) => { | 133 | (def, _) => { |
@@ -137,8 +138,7 @@ impl<'a> InferenceContext<'a> { | |||
137 | let remaining_segments_for_ty = | 138 | let remaining_segments_for_ty = |
138 | remaining_segments.take(remaining_segments.len() - 1); | 139 | remaining_segments.take(remaining_segments.len() - 1); |
139 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); | 140 | let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); |
140 | let (ty, _) = Ty::from_partly_resolved_hir_path( | 141 | let (ty, _) = ctx.lower_partly_resolved_path( |
141 | &ctx, | ||
142 | def, | 142 | def, |
143 | resolved_segment, | 143 | resolved_segment, |
144 | remaining_segments_for_ty, | 144 | remaining_segments_for_ty, |