@@ -57,17 +57,14 @@ fn alloc_uniq_raw(bcx: block, unit_ty: ty::t,
57
57
fill : ValueRef , alloc : ValueRef ) -> result {
58
58
let _icx = bcx. insn_ctxt ( "tvec::alloc_uniq_raw" ) ;
59
59
let ccx = bcx. ccx ( ) ;
60
- let llunitty = type_of :: type_of ( ccx , unit_ty ) ;
61
- let llvecty = T_vec ( ccx , llunitty ) ;
62
- let vecsize = Add ( bcx, alloc, llsize_of ( ccx, llvecty ) ) ;
63
- let vecbodyty = unit_ty ; // FIXME: This is not the correct type (#2536)
60
+
61
+ let vecbodyty = ty :: mk_mut_unboxed_vec ( bcx . tcx ( ) , unit_ty ) ;
62
+ let vecsize = Add ( bcx, alloc, llsize_of ( ccx, ccx . opaque_vec_type ) ) ;
63
+
64
64
let { box, body} = base:: malloc_unique_dyn ( bcx, vecbodyty, vecsize) ;
65
- let boxptr = PointerCast ( bcx, box,
66
- T_unique_ptr ( T_unique ( bcx. ccx ( ) , llvecty) ) ) ;
67
- let bodyptr = PointerCast ( bcx, body, T_ptr ( llvecty) ) ;
68
- Store ( bcx, fill, GEPi ( bcx, bodyptr, [ 0 u, abi:: vec_elt_fill] ) ) ;
69
- Store ( bcx, alloc, GEPi ( bcx, bodyptr, [ 0 u, abi:: vec_elt_alloc] ) ) ;
70
- ret { bcx : bcx, val : boxptr} ;
65
+ Store ( bcx, fill, GEPi ( bcx, body, [ 0 u, abi:: vec_elt_fill] ) ) ;
66
+ Store ( bcx, alloc, GEPi ( bcx, body, [ 0 u, abi:: vec_elt_alloc] ) ) ;
67
+ ret { bcx : bcx, val : box} ;
71
68
}
72
69
73
70
fn alloc_uniq ( bcx : block , unit_ty : ty:: t , elts : uint ) -> result {
@@ -91,14 +88,9 @@ fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> result {
91
88
let size = Add ( bcx, fill, llsize_of ( ccx, ccx. opaque_vec_type ) ) ;
92
89
93
90
let unit_ty = ty:: sequence_element_type ( bcx. tcx ( ) , vec_ty) ;
94
- let llunitty = type_of:: type_of ( ccx, unit_ty) ;
95
- let llvecty = T_vec ( ccx, llunitty) ;
96
- let vecbodyty = unit_ty; // FIXME: This is not the correct type (#2536)
91
+ let vecbodyty = ty:: mk_mut_unboxed_vec ( bcx. tcx ( ) , unit_ty) ;
97
92
let { box: newptr , body: new_body_ptr } =
98
93
base:: malloc_unique_dyn ( bcx, vecbodyty, size) ;
99
- let newptr = PointerCast ( bcx, newptr,
100
- T_unique_ptr ( T_unique ( bcx. ccx ( ) , llvecty) ) ) ;
101
- let new_body_ptr = PointerCast ( bcx, new_body_ptr, T_ptr ( llvecty) ) ;
102
94
call_memmove ( bcx, new_body_ptr, body_ptr, size) ;
103
95
104
96
Store ( bcx, fill, GEPi ( bcx, new_body_ptr, [ 0 u, abi:: vec_elt_alloc] ) ) ;
0 commit comments