@@ -25,6 +25,7 @@ fn trans_uniq(cx: @block_ctxt, contents: @ast::expr,
25
25
bcx = lv. bcx ;
26
26
27
27
let uniq_ty = node_id_type ( bcx_ccx ( cx) , node_id) ;
28
+ assert ty:: type_is_unique_box ( bcx_tcx ( cx) , uniq_ty) ;
28
29
let { bcx, val: llptr } = alloc_uniq ( bcx, uniq_ty) ;
29
30
30
31
bcx = move_val_if_temp ( bcx, INIT , llptr, lv,
@@ -34,6 +35,8 @@ fn trans_uniq(cx: @block_ctxt, contents: @ast::expr,
34
35
}
35
36
36
37
fn alloc_uniq ( cx : @block_ctxt , uniq_ty : ty:: t ) -> result {
38
+ assert ty:: type_is_unique_box ( bcx_tcx ( cx) , uniq_ty) ;
39
+
37
40
let bcx = cx;
38
41
let contents_ty = content_ty ( bcx, uniq_ty) ;
39
42
let r = size_of ( bcx, contents_ty) ;
@@ -52,6 +55,8 @@ fn alloc_uniq(cx: @block_ctxt, uniq_ty: ty::t) -> result {
52
55
}
53
56
54
57
fn make_free_glue ( bcx : @block_ctxt , v : ValueRef , t : ty:: t ) -> @block_ctxt {
58
+ assert ty:: type_is_unique_box ( bcx_tcx ( bcx) , t) ;
59
+
55
60
let free_cx = new_sub_block_ctxt ( bcx, "uniq_free" ) ;
56
61
let next_cx = new_sub_block_ctxt ( bcx, "uniq_free_next" ) ;
57
62
let vptr = Load ( bcx, v) ;
@@ -68,6 +73,8 @@ fn make_free_glue(bcx: @block_ctxt, v: ValueRef, t: ty::t) -> @block_ctxt {
68
73
}
69
74
70
75
fn content_ty ( bcx : @block_ctxt , t : ty:: t ) -> ty:: t {
76
+ assert ty:: type_is_unique_box ( bcx_tcx ( bcx) , t) ;
77
+
71
78
alt ty:: struct ( bcx_tcx ( bcx) , t) {
72
79
ty:: ty_uniq ( { ty: ct, _} ) { ct }
73
80
}
0 commit comments