Skip to content

Commit 60a2ab4

Browse files
author
Jonas Schievink
committed
Rename Expr::Lambda to Expr::Closure
1 parent c73513f commit 60a2ab4

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

crates/hir-def/src/body/lower.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,12 @@ impl ExprCollector<'_> {
452452
.map(|it| Interned::new(TypeRef::from_ast(&self.ctx(), it)));
453453
let body = self.collect_expr_opt(e.body());
454454
self.alloc_expr(
455-
Expr::Lambda { args: args.into(), arg_types: arg_types.into(), ret_type, body },
455+
Expr::Closure {
456+
args: args.into(),
457+
arg_types: arg_types.into(),
458+
ret_type,
459+
body,
460+
},
456461
syntax_ptr,
457462
)
458463
}

crates/hir-def/src/body/scope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
197197
let mut scope = scopes.new_labeled_scope(*scope, make_label(label));
198198
compute_expr_scopes(*body_expr, body, scopes, &mut scope);
199199
}
200-
Expr::Lambda { args, body: body_expr, .. } => {
200+
Expr::Closure { args, body: body_expr, .. } => {
201201
let mut scope = scopes.new_scope(*scope);
202202
scopes.add_params_bindings(body, scope, args);
203203
compute_expr_scopes(*body_expr, body, scopes, &mut scope);

crates/hir-def/src/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub enum Expr {
165165
base: ExprId,
166166
index: ExprId,
167167
},
168-
Lambda {
168+
Closure {
169169
args: Box<[PatId]>,
170170
arg_types: Box<[Option<Interned<TypeRef>>]>,
171171
ret_type: Option<Interned<TypeRef>>,
@@ -286,7 +286,7 @@ impl Expr {
286286
f(expr);
287287
}
288288
}
289-
Expr::Lambda { body, .. } => {
289+
Expr::Closure { body, .. } => {
290290
f(*body);
291291
}
292292
Expr::BinaryOp { lhs, rhs, .. } => {

crates/hir-ty/src/infer/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'a> InferenceContext<'a> {
218218
self.diverges = Diverges::Maybe;
219219
TyBuilder::unit()
220220
}
221-
Expr::Lambda { body, args, ret_type, arg_types } => {
221+
Expr::Closure { body, args, ret_type, arg_types } => {
222222
assert_eq!(args.len(), arg_types.len());
223223

224224
let mut sig_tys = Vec::new();
@@ -1058,7 +1058,7 @@ impl<'a> InferenceContext<'a> {
10581058
for (idx, ((&arg, param_ty), expected_ty)) in
10591059
args.iter().zip(param_iter).zip(expected_iter).enumerate()
10601060
{
1061-
let is_closure = matches!(&self.body[arg], Expr::Lambda { .. });
1061+
let is_closure = matches!(&self.body[arg], Expr::Closure { .. });
10621062
if is_closure != check_closures {
10631063
continue;
10641064
}

0 commit comments

Comments
 (0)