aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-07-23 12:21:06 -0700
committerGraydon Hoare <[email protected]>2010-07-23 12:21:06 -0700
commit6668595ebfb13e7299233ad6a9cb82b68e30128e (patch)
tree37df6b6b4bc03515f7e2acc250d33a1001a80908 /src
parentAdd pretty-printing for alt-tag statements. (diff)
downloadrust-6668595ebfb13e7299233ad6a9cb82b68e30128e.tar.xz
rust-6668595ebfb13e7299233ad6a9cb82b68e30128e.zip
Include all lval-writing statements in stmt_is_init calculation, not just "copy-like". Un-XFAIL generic-tag-alt.rs
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/boot/me/effect.ml2
-rw-r--r--src/boot/me/semant.ml4
-rw-r--r--src/boot/me/trans.ml2
-rw-r--r--src/boot/me/typestate.ml22
5 files changed, 15 insertions, 16 deletions
diff --git a/src/Makefile b/src/Makefile
index 08992377..d70da0ce 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -357,7 +357,6 @@ TEST_XFAILS_X86 := test/run-pass/bind-obj-ctor.rs \
test/run-pass/vec-slice.rs \
test/run-pass/fn-lval.rs \
test/run-pass/generic-fn-infer.rs \
- test/run-pass/generic-tag-alt.rs \
test/run-pass/generic-recursive-tag.rs \
test/run-pass/iter-ret.rs \
test/run-pass/mlist-cycle.rs \
diff --git a/src/boot/me/effect.ml b/src/boot/me/effect.ml
index 9ddef63d..fba08256 100644
--- a/src/boot/me/effect.ml
+++ b/src/boot/me/effect.ml
@@ -45,7 +45,7 @@ let mutability_checking_visitor
Ast.TY_mutable _ -> true
| _ -> false
in
- if (is_mutable or (Hashtbl.mem cx.ctxt_copy_stmt_is_init s.id))
+ if (is_mutable or (Hashtbl.mem cx.ctxt_stmt_is_init s.id))
then ()
else err (Some s.id)
"writing to non-mutable slot of type %a in statement %a"
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 41d28d32..ef73753d 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -129,7 +129,7 @@ type ctxt =
ctxt_prestates: (node_id,Bits.t) Hashtbl.t;
ctxt_poststates: (node_id,Bits.t) Hashtbl.t;
ctxt_call_lval_params: (node_id,Ast.ty array) Hashtbl.t;
- ctxt_copy_stmt_is_init: (node_id,unit) Hashtbl.t;
+ ctxt_stmt_is_init: (node_id,unit) Hashtbl.t;
ctxt_post_stmt_slot_drops: (node_id,node_id list) Hashtbl.t;
(* Translation-y stuff. *)
@@ -202,7 +202,7 @@ let new_ctxt sess abi crate =
ctxt_postconditions = Hashtbl.create 0;
ctxt_prestates = Hashtbl.create 0;
ctxt_poststates = Hashtbl.create 0;
- ctxt_copy_stmt_is_init = Hashtbl.create 0;
+ ctxt_stmt_is_init = Hashtbl.create 0;
ctxt_post_stmt_slot_drops = Hashtbl.create 0;
ctxt_call_lval_params = Hashtbl.create 0;
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml
index 3948fbd6..069fdb59 100644
--- a/src/boot/me/trans.ml
+++ b/src/boot/me/trans.ml
@@ -4199,7 +4199,7 @@ let trans_visitor
and maybe_init (id:node_id) (action:string) (dst:Ast.lval) : bool =
- let b = Hashtbl.mem cx.ctxt_copy_stmt_is_init id in
+ let b = Hashtbl.mem cx.ctxt_stmt_is_init id in
let act = if b then ("initializing-" ^ action) else action in
iflog
(fun _ ->
diff --git a/src/boot/me/typestate.ml b/src/boot/me/typestate.ml
index 83651a94..72df6e38 100644
--- a/src/boot/me/typestate.ml
+++ b/src/boot/me/typestate.ml
@@ -1074,7 +1074,14 @@ let lifecycle_visitor
| Ast.STMT_call (lv_dst, _, _)
| Ast.STMT_spawn (lv_dst, _, _, _)
| Ast.STMT_recv (lv_dst, _)
- | Ast.STMT_bind (lv_dst, _, _) ->
+ | Ast.STMT_bind (lv_dst, _, _)
+ | Ast.STMT_new_rec (lv_dst, _, _)
+ | Ast.STMT_new_tup (lv_dst, _)
+ | Ast.STMT_new_vec (lv_dst, _, _)
+ | Ast.STMT_new_str (lv_dst, _)
+ | Ast.STMT_new_port lv_dst
+ | Ast.STMT_new_chan (lv_dst, _)
+ | Ast.STMT_new_box (lv_dst, _, _) ->
let prestate = Hashtbl.find cx.ctxt_prestates s.id in
let poststate = Hashtbl.find cx.ctxt_poststates s.id in
let dst_slots = lval_slots cx lv_dst in
@@ -1097,26 +1104,18 @@ let lifecycle_visitor
log cx "noting lval %a init at stmt %a"
Ast.sprintf_lval lv_dst Ast.sprintf_stmt s
end;
- Hashtbl.replace cx.ctxt_copy_stmt_is_init s.id ();
+ Hashtbl.replace cx.ctxt_stmt_is_init s.id ();
mark_lval_live lv_dst
end;
| Ast.STMT_decl (Ast.DECL_slot (_, sloti)) ->
push_slot sloti.id
- | Ast.STMT_new_rec (lv_dst, _, _)
- | Ast.STMT_new_tup (lv_dst, _)
- | Ast.STMT_new_vec (lv_dst, _, _)
- | Ast.STMT_new_str (lv_dst, _)
- | Ast.STMT_new_port lv_dst
- | Ast.STMT_new_chan (lv_dst, _)
- | Ast.STMT_new_box (lv_dst, _, _) ->
- mark_lval_live lv_dst
-
| Ast.STMT_for f ->
log cx "noting implicit init for slot %d in for-block %d"
(int_of_node (fst f.Ast.for_slot).id)
(int_of_node (f.Ast.for_body.id));
+ Hashtbl.replace cx.ctxt_stmt_is_init s.id ();
htab_put implicit_init_block_slots
f.Ast.for_body.id
(fst f.Ast.for_slot).id
@@ -1125,6 +1124,7 @@ let lifecycle_visitor
log cx "noting implicit init for slot %d in for_each-block %d"
(int_of_node (fst f.Ast.for_each_slot).id)
(int_of_node (f.Ast.for_each_body.id));
+ Hashtbl.replace cx.ctxt_stmt_is_init s.id ();
htab_put implicit_init_block_slots
f.Ast.for_each_body.id
(fst f.Ast.for_each_slot).id