Finalize moves-based-on-type implementation.
Changes: - Refactor move mode computation - Removes move mode arguments, unary move, capture clauses (though they still parse for backwards compatibility) - Simplify how moves are handled in trans - Fix a number of illegal copies that cropped up - Workaround for bug involving def-ids in params (see details below) Future work (I'll open bugs for these...): - Improve error messages for moves that are due to bindings - Add support for moving owned content like a.b.c to borrow check, test in trans (but I think it'll "just work") - Proper fix for def-ids in params Def ids in params: Move captures into a map instead of recomputing. This is a workaround for a larger bug having to do with the def-ids associated with ty_params, which are not always properly preserved when inlining. I am not sure of my preferred fix for the larger bug yet. This current fix removes the only code in trans that I know of which relies on ty_param def-ids, but feels fragile.
This commit is contained in:
parent
42b462e076
commit
0682ad0eb9
125 changed files with 2674 additions and 2633 deletions
|
@ -466,30 +466,17 @@ pub fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
|||
expr_match(fld.fold_expr(expr),
|
||||
vec::map((*arms), |x| fld.fold_arm(*x)))
|
||||
}
|
||||
expr_fn(proto, decl, ref body, captures) => {
|
||||
let captures = do captures.map |cap_item| {
|
||||
@ast::capture_item_ {
|
||||
id: fld.new_id(cap_item.id),
|
||||
..**cap_item
|
||||
}
|
||||
};
|
||||
expr_fn(proto, fold_fn_decl(decl, fld),
|
||||
fld.fold_block((*body)),
|
||||
@captures)
|
||||
expr_fn(proto, decl, ref body) => {
|
||||
expr_fn(proto,
|
||||
fold_fn_decl(decl, fld),
|
||||
fld.fold_block(*body))
|
||||
}
|
||||
expr_fn_block(decl, ref body, captures) => {
|
||||
let captures = do captures.map |cap_item| {
|
||||
@ast::capture_item_ {
|
||||
id: fld.new_id(cap_item.id),
|
||||
..**cap_item
|
||||
}
|
||||
};
|
||||
expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block((*body)),
|
||||
@captures)
|
||||
expr_fn_block(decl, ref body) => {
|
||||
expr_fn_block(fold_fn_decl(decl, fld),
|
||||
fld.fold_block(*body))
|
||||
}
|
||||
expr_block(ref blk) => expr_block(fld.fold_block((*blk))),
|
||||
expr_copy(e) => expr_copy(fld.fold_expr(e)),
|
||||
expr_unary_move(e) => expr_unary_move(fld.fold_expr(e)),
|
||||
expr_assign(el, er) => {
|
||||
expr_assign(fld.fold_expr(el), fld.fold_expr(er))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue