use back::abi;
use back::link::{mangle_internal_name_by_path_and_seq};
-use lib::llvm::{llvm, ValueRef};
+use lib::llvm::ValueRef;
use middle::moves;
use middle::trans::base::*;
use middle::trans::build::*;
use middle::trans::type_::Type;
-use std::str;
use std::vec;
use syntax::ast;
use syntax::ast_map::path_name;
sigil: ast::Sigil) {
let _icx = push_ctxt("closure::load_environment");
- let llloadenv = match fcx.llloadenv {
- Some(ll) => ll,
- None => {
- let ll =
- str::as_c_str("load_env",
- |buf|
- unsafe {
- llvm::LLVMAppendBasicBlockInContext(fcx.ccx.llcx,
- fcx.llfn,
- buf)
- });
- fcx.llloadenv = Some(ll);
- ll
- }
- };
+ // Don't bother to create the block if there's nothing to load
+ if cap_vars.len() == 0 && !load_ret_handle {
+ return;
+ }
- let bcx = raw_block(fcx, false, llloadenv);
+ let bcx = fcx.entry_bcx.get();
// Load a pointer to the closure data, skipping over the box header:
let llcdata = opaque_box_body(bcx, cdata_ty, fcx.llenv);