sendable functions now "work", meaning pass through trans/typestate
but they do not generate correct code
This commit is contained in:
parent
aa1cd61c84
commit
7fbca4e31c
|
@ -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> {
|
fn scope_closes(sc: scope) -> option::t<bool> {
|
||||||
alt sc {
|
alt sc {
|
||||||
scope_fn(_, ast::proto_block., _) { some(true) }
|
scope_fn(_, ast::proto_block., _) { some(true) }
|
||||||
|
scope_fn(_, ast::proto_send., _) { some(false) }
|
||||||
scope_fn(_, ast::proto_shared(_), _) { some(false) }
|
scope_fn(_, ast::proto_shared(_), _) { some(false) }
|
||||||
_ { none }
|
_ { none }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2192,7 +2192,7 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
|
||||||
|| f.proto == ast::proto_shared(ast::sugar_sexy);
|
|| f.proto == ast::proto_shared(ast::sugar_sexy);
|
||||||
let env;
|
let env;
|
||||||
alt f.proto {
|
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 upvars = get_freevars(ccx.tcx, id);
|
||||||
let env_r = build_closure(bcx, upvars, copying);
|
let env_r = build_closure(bcx, upvars, copying);
|
||||||
env = env_r.ptr;
|
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);
|
load_environment(bcx, fcx, env_r.ptrty, upvars, copying);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ {
|
ast::proto_bare. {
|
||||||
env = C_null(T_opaque_closure_ptr(ccx));
|
env = C_null(T_opaque_closure_ptr(ccx));
|
||||||
trans_closure(sub_cx, sp, f, llfn, none, [], id, {|_fcx|});
|
trans_closure(sub_cx, sp, f, llfn, none, [], id, {|_fcx|});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue