]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_trans/trans/expr.rs
rollup merge of #21438: taralx/kill-racycell
[rust.git] / src / librustc_trans / trans / expr.rs
index 11d1c7e67968115382c32099a21e2ec514c756a5..da900f0a59eeb5af8fbbfac25d1dbd9dc5fee750 100644 (file)
@@ -65,7 +65,6 @@
 use trans::type_::Type;
 
 use syntax::{ast, ast_util, codemap};
-use syntax::print::pprust::{expr_to_string};
 use syntax::ptr::P;
 use syntax::parse::token;
 use std::rc::Rc;
@@ -1102,17 +1101,7 @@ fn make_field(field_name: &str, expr: P<ast::Expr>) -> ast::Field {
             // closure or an older, legacy style closure. Store this
             // into a variable to ensure the the RefCell-lock is
             // released before we recurse.
-            let is_unboxed_closure =
-                bcx.tcx().unboxed_closures.borrow().contains_key(&ast_util::local_def(expr.id));
-            if is_unboxed_closure {
-                closure::trans_unboxed_closure(bcx, &**decl, &**body, expr.id, dest)
-            } else {
-                let expr_ty = expr_ty(bcx, expr);
-                let store = ty::ty_closure_store(expr_ty);
-                debug!("translating block function {} with type {}",
-                       expr_to_string(expr), expr_ty.repr(tcx));
-                closure::trans_expr_fn(bcx, store, &**decl, &**body, expr.id, dest)
-            }
+            closure::trans_unboxed_closure(bcx, &**decl, &**body, expr.id, dest)
         }
         ast::ExprCall(ref f, ref args) => {
             if bcx.tcx().is_method_call(expr.id) {