diff options
| author | Graydon Hoare <[email protected]> | 2010-07-02 16:16:57 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-07-02 16:16:57 -0700 |
| commit | 026cdf97474402f206a8627a533809c4751abe8b (patch) | |
| tree | 397a5cb333bc6c4ff1dba5168bc9aaa3038b15f5 /src | |
| parent | Teach severing logic to handle obj and fn types. (diff) | |
| download | rust-026cdf97474402f206a8627a533809c4751abe8b.tar.xz rust-026cdf97474402f206a8627a533809c4751abe8b.zip | |
Fix bug in clone logic; was ignoring the mutability-strip step in later rule.
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot/me/trans.ml | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index d86c754e..abeff66e 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -2586,27 +2586,28 @@ let trans_visitor (ty:Ast.ty) (curr_iso:Ast.ty_iso option) : unit = - match strip_mutable_or_constrained_ty ty with - Ast.TY_chan _ -> - trans_upcall "upcall_clone_chan" dst - [| (Il.Cell clone_task); (Il.Cell src) |] - | Ast.TY_task - | Ast.TY_port _ - | _ when type_has_state ty - -> bug () "cloning mutable type" - | _ when i64_le (ty_sz abi ty) word_sz - -> mov dst (Il.Cell src) - | Ast.TY_fn _ - | Ast.TY_obj _ -> () - | Ast.TY_box ty -> - let glue_fix = get_clone_glue ty curr_iso in - trans_call_static_glue - (code_fixup_to_ptr_operand glue_fix) - (Some dst) - [| alias ty_params; src; clone_task |] - | _ -> - iter_ty_parts_full ty_params dst src ty - (clone_ty ty_params clone_task) curr_iso + let ty = strip_mutable_or_constrained_ty ty in + match ty with + Ast.TY_chan _ -> + trans_upcall "upcall_clone_chan" dst + [| (Il.Cell clone_task); (Il.Cell src) |] + | Ast.TY_task + | Ast.TY_port _ + | _ when type_has_state ty + -> bug () "cloning state type" + | _ when i64_le (ty_sz abi ty) word_sz + -> mov dst (Il.Cell src) + | Ast.TY_fn _ + | Ast.TY_obj _ -> () + | Ast.TY_box ty -> + let glue_fix = get_clone_glue ty curr_iso in + trans_call_static_glue + (code_fixup_to_ptr_operand glue_fix) + (Some dst) + [| alias ty_params; src; clone_task |] + | _ -> + iter_ty_parts_full ty_params dst src ty + (clone_ty ty_params clone_task) curr_iso and free_ty (is_gc:bool) |