1
Fork 0

auto merge of #19113 : nikomatsakis/rust/unboxed-boxed-closure-unification, r=acrichto

Use the expected type to infer the argument/return types of unboxed closures. Also, in `||` expressions, use the expected type to decide if the result should be a boxed or unboxed closure (and if an unboxed closure, what kind).

This supercedes PR #19089, which was already reviewed by @pcwalton.
This commit is contained in:
bors 2014-11-20 12:01:44 +00:00
commit 1d81776209
34 changed files with 595 additions and 344 deletions

View file

@ -1326,18 +1326,13 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
arms.move_map(|x| folder.fold_arm(x)),
source)
}
ExprFnBlock(capture_clause, decl, body) => {
ExprFnBlock(capture_clause,
folder.fold_fn_decl(decl),
folder.fold_block(body))
}
ExprProc(decl, body) => {
ExprProc(folder.fold_fn_decl(decl),
folder.fold_block(body))
}
ExprUnboxedFn(capture_clause, kind, decl, body) => {
ExprUnboxedFn(capture_clause,
kind,
ExprClosure(capture_clause, opt_kind, decl, body) => {
ExprClosure(capture_clause,
opt_kind,
folder.fold_fn_decl(decl),
folder.fold_block(body))
}