Skip to content

Commit 3f74c6a

Browse files
trans: Make base::custom_coerce_unsize_info only depend on SharedCrateContext.
1 parent 566aa54 commit 3f74c6a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/librustc_trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ pub fn coerce_unsized_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
664664
}
665665
}
666666

667-
pub fn custom_coerce_unsize_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
667+
pub fn custom_coerce_unsize_info<'ccx, 'tcx>(ccx: &SharedCrateContext<'ccx, 'tcx>,
668668
source_ty: Ty<'tcx>,
669669
target_ty: Ty<'tcx>)
670670
-> CustomCoerceUnsized {
@@ -678,7 +678,7 @@ pub fn custom_coerce_unsize_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
678678
substs: ccx.tcx().mk_substs(trait_substs)
679679
});
680680

681-
match fulfill_obligation(ccx.shared(), DUMMY_SP, trait_ref) {
681+
match fulfill_obligation(ccx, DUMMY_SP, trait_ref) {
682682
traits::VtableImpl(traits::VtableImplData { impl_def_id, .. }) => {
683683
ccx.tcx().custom_coerce_unsized_kind(impl_def_id)
684684
}

src/librustc_trans/collector.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ use syntax::parse::token;
211211

212212
use base::{custom_coerce_unsize_info, llvm_linkage_by_name};
213213
use context::CrateContext;
214-
use common::{fulfill_obligation, normalize_and_test_predicates,
215-
type_is_sized};
214+
use common::{fulfill_obligation, normalize_and_test_predicates, type_is_sized};
216215
use glue::{self, DropGlueKind};
217216
use llvm;
218217
use meth;
@@ -937,7 +936,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
937936
&ty::TyStruct(target_adt_def, target_substs)) => {
938937
assert_eq!(source_adt_def, target_adt_def);
939938

940-
let kind = custom_coerce_unsize_info(ccx, source_ty, target_ty);
939+
let kind = custom_coerce_unsize_info(ccx.shared(), source_ty, target_ty);
941940

942941
let coerce_index = match kind {
943942
CustomCoerceUnsized::Struct(i) => i

src/librustc_trans/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
510510
let source = unpack_datum!(bcx, source.to_ref_datum(bcx));
511511
assert!(target.kind.is_by_ref());
512512

513-
let kind = custom_coerce_unsize_info(bcx.ccx(), source.ty, target.ty);
513+
let kind = custom_coerce_unsize_info(bcx.ccx().shared(),
514+
source.ty,
515+
target.ty);
514516

515517
let repr_source = adt::represent_type(bcx.ccx(), source.ty);
516518
let src_fields = match &*repr_source {

0 commit comments

Comments
 (0)