Skip to content

Commit

Permalink
trans: Make base::custom_coerce_unsize_info only depend on SharedCrat…
Browse files Browse the repository at this point in the history
…eContext.
  • Loading branch information
michaelwoerister committed May 9, 2016
1 parent 566aa54 commit 3f74c6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/librustc_trans/base.rs
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_trans/collector.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_trans/expr.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 3f74c6a

Please sign in to comment.