Skip to content

Commit fdc830d

Browse files
committed
auto merge of #10289 : nikomatsakis/rust/issue-10157-TypeContents-refactor, r=pcwalton
See #10157. This compiles now. Fixes #10278.
2 parents dda67df + 71acc54 commit fdc830d

File tree

19 files changed

+404
-280
lines changed

19 files changed

+404
-280
lines changed

src/librustc/middle/trans/_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
16001600
let pat_ty = node_id_type(bcx, pat_id);
16011601
let llbox = Load(bcx, val);
16021602
let unboxed = match ty::get(pat_ty).sty {
1603-
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).contains_managed() => llbox,
1603+
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
16041604
_ => GEPi(bcx, llbox, [0u, abi::box_field_body])
16051605
};
16061606
compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
@@ -2220,7 +2220,7 @@ fn bind_irrefutable_pat(bcx: @mut Block,
22202220
let pat_ty = node_id_type(bcx, pat.id);
22212221
let llbox = Load(bcx, val);
22222222
let unboxed = match ty::get(pat_ty).sty {
2223-
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).contains_managed() => llbox,
2223+
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
22242224
_ => GEPi(bcx, llbox, [0u, abi::box_field_body])
22252225
};
22262226
bcx = bind_irrefutable_pat(bcx, inner, unboxed, binding_mode);

src/librustc/middle/trans/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ pub fn malloc_general(bcx: @mut Block, t: ty::t, heap: heap) -> MallocResult {
409409
}
410410

411411
pub fn heap_for_unique(bcx: @mut Block, t: ty::t) -> heap {
412-
if ty::type_contents(bcx.tcx(), t).contains_managed() {
412+
if ty::type_contents(bcx.tcx(), t).owns_managed() {
413413
heap_managed_unique
414414
} else {
415415
heap_exchange

src/librustc/middle/trans/closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
156156
}
157157

158158
fn heap_for_unique_closure(bcx: @mut Block, t: ty::t) -> heap {
159-
if ty::type_contents(bcx.tcx(), t).contains_managed() {
159+
if ty::type_contents(bcx.tcx(), t).owns_managed() {
160160
heap_managed_unique
161161
} else {
162162
heap_exchange_closure

src/librustc/middle/trans/datum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ impl Datum {
566566
}
567567
};
568568

569-
if !header && !ty::type_contents(bcx.tcx(), content_ty).contains_managed() {
569+
if !header && !ty::type_contents(bcx.tcx(), content_ty).owns_managed() {
570570
let ptr = self.to_value_llval(bcx);
571571
let ty = type_of::type_of(bcx.ccx(), content_ty);
572572
let body = PointerCast(bcx, ptr, ty.ptr_to());

src/librustc/middle/trans/debuginfo.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,7 @@ fn type_metadata(cx: &mut CrateContext,
20602060
ty::vstore_fixed(len) => {
20612061
fixed_vec_metadata(cx, mt.ty, len, usage_site_span)
20622062
}
2063-
ty::vstore_uniq if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
2063+
ty::vstore_uniq if ty::type_contents(cx.tcx, mt.ty).owns_managed() => {
20642064
let boxed_vec_metadata = boxed_vec_metadata(cx, mt.ty, usage_site_span);
20652065
pointer_type_metadata(cx, t, boxed_vec_metadata)
20662066
}
@@ -2077,7 +2077,7 @@ fn type_metadata(cx: &mut CrateContext,
20772077
}
20782078
}
20792079
},
2080-
ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
2080+
ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).owns_managed() => {
20812081
create_pointer_to_box_metadata(cx, t, mt.ty)
20822082
},
20832083
ty::ty_uniq(ref mt) |

src/librustc/middle/trans/glue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
603603

604604
let has_header = match ty::get(t).sty {
605605
ty::ty_box(*) => true,
606-
ty::ty_uniq(*) => ty::type_contents(ccx.tcx, t).contains_managed(),
606+
ty::ty_uniq(*) => ty::type_contents(ccx.tcx, t).owns_managed(),
607607
_ => false
608608
};
609609

src/librustc/middle/trans/intrinsic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
387387
let tp_ty = substs.tys[0];
388388
Ret(bcx, C_bool(ty::type_needs_drop(ccx.tcx, tp_ty)));
389389
}
390-
"contains_managed" => {
390+
"owns_managed" => {
391391
let tp_ty = substs.tys[0];
392-
Ret(bcx, C_bool(ty::type_contents(ccx.tcx, tp_ty).contains_managed()));
392+
Ret(bcx, C_bool(ty::type_contents(ccx.tcx, tp_ty).owns_managed()));
393393
}
394394
"visit_tydesc" => {
395395
let td = get_param(decl, first_real_arg);

src/librustc/middle/trans/reflect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl Reflector {
183183
ty::ty_evec(ref mt, vst) => {
184184
let (name, extra) = self.vstore_name_and_extra(t, vst);
185185
let extra = extra + self.c_mt(mt);
186-
if "uniq" == name && ty::type_contents(bcx.tcx(), t).contains_managed() {
186+
if "uniq" == name && ty::type_contents(bcx.tcx(), t).owns_managed() {
187187
self.visit("evec_uniq_managed", extra)
188188
} else {
189189
self.visit(~"evec_" + name, extra)
@@ -195,7 +195,7 @@ impl Reflector {
195195
}
196196
ty::ty_uniq(ref mt) => {
197197
let extra = self.c_mt(mt);
198-
if ty::type_contents(bcx.tcx(), t).contains_managed() {
198+
if ty::type_contents(bcx.tcx(), t).owns_managed() {
199199
self.visit("uniq_managed", extra)
200200
} else {
201201
self.visit("uniq", extra)

src/librustc/middle/trans/tvec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn get_alloc(bcx: @mut Block, vptr: ValueRef) -> ValueRef {
6565
}
6666

6767
pub fn get_bodyptr(bcx: @mut Block, vptr: ValueRef, t: ty::t) -> ValueRef {
68-
if ty::type_contents(bcx.tcx(), t).contains_managed() {
68+
if ty::type_contents(bcx.tcx(), t).owns_managed() {
6969
GEPi(bcx, vptr, [0u, abi::box_field_body])
7070
} else {
7171
vptr

src/librustc/middle/trans/type_of.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
226226
ty::ty_opaque_box => Type::opaque_box(cx).ptr_to(),
227227
ty::ty_uniq(ref mt) => {
228228
let ty = type_of(cx, mt.ty);
229-
if ty::type_contents(cx.tcx, mt.ty).contains_managed() {
229+
if ty::type_contents(cx.tcx, mt.ty).owns_managed() {
230230
Type::unique(cx, &ty).ptr_to()
231231
} else {
232232
ty.ptr_to()
@@ -235,7 +235,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
235235
ty::ty_evec(ref mt, ty::vstore_uniq) => {
236236
let ty = type_of(cx, mt.ty);
237237
let ty = Type::vec(cx.sess.targ_cfg.arch, &ty);
238-
if ty::type_contents(cx.tcx, mt.ty).contains_managed() {
238+
if ty::type_contents(cx.tcx, mt.ty).owns_managed() {
239239
Type::unique(cx, &ty).ptr_to()
240240
} else {
241241
ty.ptr_to()

src/librustc/middle/trans/uniq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn make_free_glue(bcx: @mut Block, vptrptr: ValueRef, box_ty: ty::t)
2727
let body_datum = box_datum.box_body(bcx);
2828
let bcx = glue::drop_ty(bcx, body_datum.to_ref_llval(bcx),
2929
body_datum.ty);
30-
if ty::type_contents(bcx.tcx(), box_ty).contains_managed() {
30+
if ty::type_contents(bcx.tcx(), box_ty).owns_managed() {
3131
glue::trans_free(bcx, box_datum.val)
3232
} else {
3333
glue::trans_exchange_free(bcx, box_datum.val)

0 commit comments

Comments
 (0)