trans: Make base::custom_coerce_unsize_info only depend on SharedCrateContext.

This commit is contained in:
Michael Woerister 2016-05-06 00:55:53 -04:00
parent 566aa54b49
commit 3f74c6afe0
3 changed files with 7 additions and 6 deletions

View File

@ -664,7 +664,7 @@ pub fn coerce_unsized_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
}
}
pub fn custom_coerce_unsize_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
pub fn custom_coerce_unsize_info<'ccx, 'tcx>(ccx: &SharedCrateContext<'ccx, 'tcx>,
source_ty: Ty<'tcx>,
target_ty: Ty<'tcx>)
-> CustomCoerceUnsized {
@ -678,7 +678,7 @@ pub fn custom_coerce_unsize_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
substs: ccx.tcx().mk_substs(trait_substs)
});
match fulfill_obligation(ccx.shared(), DUMMY_SP, trait_ref) {
match fulfill_obligation(ccx, DUMMY_SP, trait_ref) {
traits::VtableImpl(traits::VtableImplData { impl_def_id, .. }) => {
ccx.tcx().custom_coerce_unsized_kind(impl_def_id)
}

View File

@ -211,8 +211,7 @@ use syntax::parse::token;
use base::{custom_coerce_unsize_info, llvm_linkage_by_name};
use context::CrateContext;
use common::{fulfill_obligation, normalize_and_test_predicates,
type_is_sized};
use common::{fulfill_obligation, normalize_and_test_predicates, type_is_sized};
use glue::{self, DropGlueKind};
use llvm;
use meth;
@ -937,7 +936,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
&ty::TyStruct(target_adt_def, target_substs)) => {
assert_eq!(source_adt_def, target_adt_def);
let kind = custom_coerce_unsize_info(ccx, source_ty, target_ty);
let kind = custom_coerce_unsize_info(ccx.shared(), source_ty, target_ty);
let coerce_index = match kind {
CustomCoerceUnsized::Struct(i) => i

View File

@ -510,7 +510,9 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
let source = unpack_datum!(bcx, source.to_ref_datum(bcx));
assert!(target.kind.is_by_ref());
let kind = custom_coerce_unsize_info(bcx.ccx(), source.ty, target.ty);
let kind = custom_coerce_unsize_info(bcx.ccx().shared(),
source.ty,
target.ty);
let repr_source = adt::represent_type(bcx.ccx(), source.ty);
let src_fields = match &*repr_source {