Skip to content

Commit 7fbca4e

Browse files
committed
sendable functions now "work", meaning pass through trans/typestate
but they do not generate correct code
1 parent aa1cd61 commit 7fbca4e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/comp/middle/resolve.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,14 @@ fn scope_is_fn(sc: scope) -> bool {
678678
};
679679
}
680680

681+
// Returns:
682+
// none - does not close
683+
// some(true) - closes and permits mutation
684+
// some(false) - closes but no mutation
681685
fn scope_closes(sc: scope) -> option::t<bool> {
682686
alt sc {
683687
scope_fn(_, ast::proto_block., _) { some(true) }
688+
scope_fn(_, ast::proto_send., _) { some(false) }
684689
scope_fn(_, ast::proto_shared(_), _) { some(false) }
685690
_ { none }
686691
}

src/comp/middle/trans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
21922192
|| f.proto == ast::proto_shared(ast::sugar_sexy);
21932193
let env;
21942194
alt f.proto {
2195-
ast::proto_block. | ast::proto_shared(_) {
2195+
ast::proto_block. | ast::proto_shared(_) | ast::proto_send. {
21962196
let upvars = get_freevars(ccx.tcx, id);
21972197
let env_r = build_closure(bcx, upvars, copying);
21982198
env = env_r.ptr;
@@ -2201,7 +2201,7 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
22012201
load_environment(bcx, fcx, env_r.ptrty, upvars, copying);
22022202
});
22032203
}
2204-
_ {
2204+
ast::proto_bare. {
22052205
env = C_null(T_opaque_closure_ptr(ccx));
22062206
trans_closure(sub_cx, sp, f, llfn, none, [], id, {|_fcx|});
22072207
}

0 commit comments

Comments
 (0)