Skip to content

Issue 10157 type contents refactor #10289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
let pat_ty = node_id_type(bcx, pat_id);
let llbox = Load(bcx, val);
let unboxed = match ty::get(pat_ty).sty {
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).contains_managed() => llbox,
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
_ => GEPi(bcx, llbox, [0u, abi::box_field_body])
};
compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
Expand Down Expand Up @@ -2220,7 +2220,7 @@ fn bind_irrefutable_pat(bcx: @mut Block,
let pat_ty = node_id_type(bcx, pat.id);
let llbox = Load(bcx, val);
let unboxed = match ty::get(pat_ty).sty {
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).contains_managed() => llbox,
ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
_ => GEPi(bcx, llbox, [0u, abi::box_field_body])
};
bcx = bind_irrefutable_pat(bcx, inner, unboxed, binding_mode);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ pub fn malloc_general(bcx: @mut Block, t: ty::t, heap: heap) -> MallocResult {
}

pub fn heap_for_unique(bcx: @mut Block, t: ty::t) -> heap {
if ty::type_contents(bcx.tcx(), t).contains_managed() {
if ty::type_contents(bcx.tcx(), t).owns_managed() {
heap_managed_unique
} else {
heap_exchange
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
}

fn heap_for_unique_closure(bcx: @mut Block, t: ty::t) -> heap {
if ty::type_contents(bcx.tcx(), t).contains_managed() {
if ty::type_contents(bcx.tcx(), t).owns_managed() {
heap_managed_unique
} else {
heap_exchange_closure
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ impl Datum {
}
};

if !header && !ty::type_contents(bcx.tcx(), content_ty).contains_managed() {
if !header && !ty::type_contents(bcx.tcx(), content_ty).owns_managed() {
let ptr = self.to_value_llval(bcx);
let ty = type_of::type_of(bcx.ccx(), content_ty);
let body = PointerCast(bcx, ptr, ty.ptr_to());
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ fn type_metadata(cx: &mut CrateContext,
ty::vstore_fixed(len) => {
fixed_vec_metadata(cx, mt.ty, len, usage_site_span)
}
ty::vstore_uniq if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
ty::vstore_uniq if ty::type_contents(cx.tcx, mt.ty).owns_managed() => {
let boxed_vec_metadata = boxed_vec_metadata(cx, mt.ty, usage_site_span);
pointer_type_metadata(cx, t, boxed_vec_metadata)
}
Expand All @@ -2077,7 +2077,7 @@ fn type_metadata(cx: &mut CrateContext,
}
}
},
ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).owns_managed() => {
create_pointer_to_box_metadata(cx, t, mt.ty)
},
ty::ty_uniq(ref mt) |
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {

let has_header = match ty::get(t).sty {
ty::ty_box(*) => true,
ty::ty_uniq(*) => ty::type_contents(ccx.tcx, t).contains_managed(),
ty::ty_uniq(*) => ty::type_contents(ccx.tcx, t).owns_managed(),
_ => false
};

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
let tp_ty = substs.tys[0];
Ret(bcx, C_bool(ty::type_needs_drop(ccx.tcx, tp_ty)));
}
"contains_managed" => {
"owns_managed" => {
let tp_ty = substs.tys[0];
Ret(bcx, C_bool(ty::type_contents(ccx.tcx, tp_ty).contains_managed()));
Ret(bcx, C_bool(ty::type_contents(ccx.tcx, tp_ty).owns_managed()));
}
"visit_tydesc" => {
let td = get_param(decl, first_real_arg);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl Reflector {
ty::ty_evec(ref mt, vst) => {
let (name, extra) = self.vstore_name_and_extra(t, vst);
let extra = extra + self.c_mt(mt);
if "uniq" == name && ty::type_contents(bcx.tcx(), t).contains_managed() {
if "uniq" == name && ty::type_contents(bcx.tcx(), t).owns_managed() {
self.visit("evec_uniq_managed", extra)
} else {
self.visit(~"evec_" + name, extra)
Expand All @@ -195,7 +195,7 @@ impl Reflector {
}
ty::ty_uniq(ref mt) => {
let extra = self.c_mt(mt);
if ty::type_contents(bcx.tcx(), t).contains_managed() {
if ty::type_contents(bcx.tcx(), t).owns_managed() {
self.visit("uniq_managed", extra)
} else {
self.visit("uniq", extra)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/tvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn get_alloc(bcx: @mut Block, vptr: ValueRef) -> ValueRef {
}

pub fn get_bodyptr(bcx: @mut Block, vptr: ValueRef, t: ty::t) -> ValueRef {
if ty::type_contents(bcx.tcx(), t).contains_managed() {
if ty::type_contents(bcx.tcx(), t).owns_managed() {
GEPi(bcx, vptr, [0u, abi::box_field_body])
} else {
vptr
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
ty::ty_opaque_box => Type::opaque_box(cx).ptr_to(),
ty::ty_uniq(ref mt) => {
let ty = type_of(cx, mt.ty);
if ty::type_contents(cx.tcx, mt.ty).contains_managed() {
if ty::type_contents(cx.tcx, mt.ty).owns_managed() {
Type::unique(cx, &ty).ptr_to()
} else {
ty.ptr_to()
Expand All @@ -235,7 +235,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
ty::ty_evec(ref mt, ty::vstore_uniq) => {
let ty = type_of(cx, mt.ty);
let ty = Type::vec(cx.sess.targ_cfg.arch, &ty);
if ty::type_contents(cx.tcx, mt.ty).contains_managed() {
if ty::type_contents(cx.tcx, mt.ty).owns_managed() {
Type::unique(cx, &ty).ptr_to()
} else {
ty.ptr_to()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/uniq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn make_free_glue(bcx: @mut Block, vptrptr: ValueRef, box_ty: ty::t)
let body_datum = box_datum.box_body(bcx);
let bcx = glue::drop_ty(bcx, body_datum.to_ref_llval(bcx),
body_datum.ty);
if ty::type_contents(bcx.tcx(), box_ty).contains_managed() {
if ty::type_contents(bcx.tcx(), box_ty).owns_managed() {
glue::trans_free(bcx, box_datum.val)
} else {
glue::trans_exchange_free(bcx, box_datum.val)
Expand Down
Loading