Include capture clauses when generating metadata.
This may fix the bug that's blocking Issue #2441.
This commit is contained in:
parent
6abddca18b
commit
f49b891ce5
4 changed files with 18 additions and 10 deletions
|
@ -427,12 +427,17 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_alt(fld.fold_expr(expr), vec::map(arms, fld.fold_arm), mode)
|
expr_alt(fld.fold_expr(expr), vec::map(arms, fld.fold_arm), mode)
|
||||||
}
|
}
|
||||||
expr_fn(proto, decl, body, captures) {
|
expr_fn(proto, decl, body, captures) {
|
||||||
expr_fn(proto, fold_fn_decl(decl, fld),
|
expr_fn(proto, fold_fn_decl(decl, fld),
|
||||||
fld.fold_block(body), captures)
|
fld.fold_block(body),
|
||||||
|
@((*captures).map({|cap_item|
|
||||||
|
@({id: fld.new_id((*cap_item).id)
|
||||||
|
with *cap_item})})))
|
||||||
}
|
}
|
||||||
expr_fn_block(decl, body, captures) {
|
expr_fn_block(decl, body, captures) {
|
||||||
expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block(body),
|
expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block(body),
|
||||||
captures)
|
@((*captures).map({|cap_item|
|
||||||
|
@({id: fld.new_id((*cap_item).id)
|
||||||
|
with *cap_item})})))
|
||||||
}
|
}
|
||||||
expr_block(blk) { expr_block(fld.fold_block(blk)) }
|
expr_block(blk) { expr_block(fld.fold_block(blk)) }
|
||||||
expr_move(el, er) {
|
expr_move(el, er) {
|
||||||
|
|
|
@ -252,7 +252,11 @@ fn visit_ids(item: ast::inlined_item, vfn: fn@(ast::node_id)) {
|
||||||
vfn(m.self_id);
|
vfn(m.self_id);
|
||||||
vec::iter(tps) {|tp| vfn(tp.id)}
|
vec::iter(tps) {|tp| vfn(tp.id)}
|
||||||
}
|
}
|
||||||
visit::fk_anon(*) | visit::fk_fn_block(*) {
|
visit::fk_anon(_, capture_clause)
|
||||||
|
| visit::fk_fn_block(capture_clause) {
|
||||||
|
for vec::each(*capture_clause) {|clause|
|
||||||
|
vfn(clause.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,9 @@ fn compute_capture_vars(tcx: ty::ctxt,
|
||||||
// first add entries for anything explicitly named in the cap clause
|
// first add entries for anything explicitly named in the cap clause
|
||||||
|
|
||||||
for (*cap_clause).each { |cap_item|
|
for (*cap_clause).each { |cap_item|
|
||||||
|
#debug("Doing capture var: %s (%?)",
|
||||||
|
cap_item.name, cap_item.id);
|
||||||
|
|
||||||
let cap_def = tcx.def_map.get(cap_item.id);
|
let cap_def = tcx.def_map.get(cap_item.id);
|
||||||
let cap_def_id = ast_util::def_id_of_def(cap_def).node;
|
let cap_def_id = ast_util::def_id_of_def(cap_def).node;
|
||||||
if cap_item.is_move {
|
if cap_item.is_move {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// xfail-test :(
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
An implementation of the Graph500 Bread First Search problem in Rust.
|
An implementation of the Graph500 Bread First Search problem in Rust.
|
||||||
|
@ -267,8 +265,7 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let graph_arc = arc::shared_arc(copy graph);
|
let (res, graph) = arc::shared_arc(copy graph);
|
||||||
let graph = *graph_arc;
|
|
||||||
|
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
while par::any(colors, is_gray) {
|
while par::any(colors, is_gray) {
|
||||||
|
@ -277,8 +274,7 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result {
|
||||||
i += 1u;
|
i += 1u;
|
||||||
let old_len = colors.len();
|
let old_len = colors.len();
|
||||||
|
|
||||||
let colors_arc = arc::shared_arc(copy colors);
|
let (res, color) = arc::shared_arc(copy colors);
|
||||||
let color = *colors_arc;
|
|
||||||
|
|
||||||
colors = par::mapi(colors) {|i, c|
|
colors = par::mapi(colors) {|i, c|
|
||||||
let c : color = c;
|
let c : color = c;
|
||||||
|
|
Loading…
Add table
Reference in a new issue