aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer/expr.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-12 13:52:30 +0000
committerGitHub <[email protected]>2019-11-12 13:52:30 +0000
commit55f3ff241a2105d2903266703474acbd24a85e84 (patch)
treed953d49eac9da39748afabd512b5390875e18ba1 /crates/ra_hir/src/ty/infer/expr.rs
parent6149ee30ef9a379f642c8a645cea13f32c4f3d84 (diff)
parentfe00db72b91d266a61b0541bca59e38e5f2a703c (diff)
Merge #2222
2222: Remove owner from Body r=matklad a=matklad cc @flodiebold I do this so that it's easier to move lowering code to another crate (owner is the only thing that tethers Body to the rest of the code), but it's interesting that this is a net reduction of lines. I think this might be considered an evidence that it's a good idea to not add "parent pointers" / parent ids to data structures, and instead add them to `ctx` objects which are used when building data structures bors r+ Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/infer/expr.rs')
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs
index 6d9792391..c6802487a 100644
--- a/crates/ra_hir/src/ty/infer/expr.rs
+++ b/crates/ra_hir/src/ty/infer/expr.rs
@@ -130,10 +130,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
130 TypeCtor::FnPtr { num_args: sig_tys.len() as u16 - 1 }, 130 TypeCtor::FnPtr { num_args: sig_tys.len() as u16 - 1 },
131 Substs(sig_tys.into()), 131 Substs(sig_tys.into()),
132 ); 132 );
133 let closure_ty = Ty::apply_one( 133 let closure_ty =
134 TypeCtor::Closure { def: self.body.owner(), expr: tgt_expr }, 134 Ty::apply_one(TypeCtor::Closure { def: self.owner, expr: tgt_expr }, sig_ty);
135 sig_ty,
136 );
137 135
138 // Eagerly try to relate the closure type with the expected 136 // Eagerly try to relate the closure type with the expected
139 // type, otherwise we often won't have enough information to 137 // type, otherwise we often won't have enough information to
@@ -184,7 +182,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
184 } 182 }
185 Expr::Path(p) => { 183 Expr::Path(p) => {
186 // FIXME this could be more efficient... 184 // FIXME this could be more efficient...
187 let resolver = expr::resolver_for_expr(self.body.clone(), self.db, tgt_expr); 185 let resolver = expr::resolver_for_expr(self.db, self.owner, tgt_expr);
188 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) 186 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown)
189 } 187 }
190 Expr::Continue => Ty::simple(TypeCtor::Never), 188 Expr::Continue => Ty::simple(TypeCtor::Never),