Skip to content

Commit 336f22d

Browse files
committed
rustc: Resolve upvars as necessary
1 parent 0117cf2 commit 336f22d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/comp/middle/trans.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,8 +3338,15 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
33383338
ret lval_mem(cx, cx.fcx.llargs.get(did));
33393339
}
33403340
case (ast.def_local(?did)) {
3341-
check (cx.fcx.lllocals.contains_key(did));
3342-
ret lval_mem(cx, cx.fcx.lllocals.get(did));
3341+
alt (cx.fcx.lllocals.find(did)) {
3342+
case (none[ValueRef]) {
3343+
check (cx.fcx.llupvars.contains_key(did));
3344+
ret lval_mem(cx, cx.fcx.llupvars.get(did));
3345+
}
3346+
case (some[ValueRef](?llval)) {
3347+
ret lval_mem(cx, llval);
3348+
}
3349+
}
33433350
}
33443351
case (ast.def_binding(?did)) {
33453352
check (cx.fcx.lllocals.contains_key(did));

0 commit comments

Comments
 (0)