sendable functions now "work", meaning pass through trans/typestate

but they do not generate correct code
This commit is contained in:
Niko Matsakis 2011-12-09 19:12:03 -08:00
parent aa1cd61c84
commit 7fbca4e31c
2 changed files with 7 additions and 2 deletions

View File

@ -678,9 +678,14 @@ fn scope_is_fn(sc: scope) -> bool {
};
}
// Returns:
// none - does not close
// some(true) - closes and permits mutation
// some(false) - closes but no mutation
fn scope_closes(sc: scope) -> option::t<bool> {
alt sc {
scope_fn(_, ast::proto_block., _) { some(true) }
scope_fn(_, ast::proto_send., _) { some(false) }
scope_fn(_, ast::proto_shared(_), _) { some(false) }
_ { none }
}

View File

@ -2192,7 +2192,7 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
|| f.proto == ast::proto_shared(ast::sugar_sexy);
let env;
alt f.proto {
ast::proto_block. | ast::proto_shared(_) {
ast::proto_block. | ast::proto_shared(_) | ast::proto_send. {
let upvars = get_freevars(ccx.tcx, id);
let env_r = build_closure(bcx, upvars, copying);
env = env_r.ptr;
@ -2201,7 +2201,7 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
load_environment(bcx, fcx, env_r.ptrty, upvars, copying);
});
}
_ {
ast::proto_bare. {
env = C_null(T_opaque_closure_ptr(ccx));
trans_closure(sub_cx, sp, f, llfn, none, [], id, {|_fcx|});
}