Skip to content

Commit bf674ec

Browse files
trans: Make base::custom_coerce_unsize_info only depend on SharedCrateContext.
1 parent 09d2712 commit bf674ec

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
@@ -665,7 +665,7 @@ pub fn coerce_unsized_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
665665
}
666666
}
667667

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

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

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;
@@ -934,7 +933,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
934933
&ty::TyStruct(target_adt_def, target_substs)) => {
935934
assert_eq!(source_adt_def, target_adt_def);
936935

937-
let kind = custom_coerce_unsize_info(ccx, source_ty, target_ty);
936+
let kind = custom_coerce_unsize_info(ccx.shared(), source_ty, target_ty);
938937

939938
let coerce_index = match kind {
940939
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)