rustc: Add a few type-related methods to unique pointers; add typestate support
This commit is contained in:
parent
42034f5e34
commit
e3d5b8a8d5
3 changed files with 15 additions and 1 deletions
|
|
@ -596,6 +596,7 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
|||
none. { clear_pp(expr_pp(fcx.ccx, e)); }
|
||||
}
|
||||
}
|
||||
expr_uniq(sub) { find_pre_post_exprs(fcx, ~[sub], e.id); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -704,6 +704,7 @@ fn walk_ty(cx: &ctxt, walker: ty_walk, ty: t) {
|
|||
}
|
||||
ty_var(_) {/* no-op */ }
|
||||
ty_param(_,_) {/* no-op */ }
|
||||
ty_uniq(sub) { walk_ty(cx, walker, sub); }
|
||||
}
|
||||
walker(ty);
|
||||
}
|
||||
|
|
@ -1232,6 +1233,7 @@ fn type_has_dynamic_size(cx: &ctxt, ty: &t) -> bool {
|
|||
ty_param(_,_) { ret true; }
|
||||
ty_type. { ret false; }
|
||||
ty_native(_) { ret false; }
|
||||
ty_uniq(_) { ret false; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1583,6 +1585,11 @@ fn hash_type_structure(st: &sty) -> uint {
|
|||
for c: @type_constr in cs { h += h << 5u + hash_type_constr(h, c); }
|
||||
ret h;
|
||||
}
|
||||
ty_uniq(t) {
|
||||
let h = 37u;
|
||||
h += h << 5u + hash_ty(t);
|
||||
ret h;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1823,6 +1830,12 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool {
|
|||
_ { ret false; }
|
||||
}
|
||||
}
|
||||
ty_uniq(t_a) {
|
||||
alt b {
|
||||
ty_uniq(t_b) { ret t_a == t_b; }
|
||||
_ { ret false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2504,7 +2504,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
|||
}
|
||||
ast::expr_uniq(x) {
|
||||
let t = next_ty_var(fcx);
|
||||
check_expr_with(fcx, x, ty::mk_uniq(tcx, t));
|
||||
check_expr_with(fcx, x, t);
|
||||
write::ty_only_fixup(fcx, id, ty::mk_uniq(tcx, t));
|
||||
}
|
||||
_ { tcx.sess.unimpl("expr type in typeck::check_expr"); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue