1
Fork 0

Some rebinds and dummys

This commit is contained in:
Jack Huey 2021-01-07 00:41:55 -05:00
parent a5029ac0ab
commit 4955d755d3
9 changed files with 29 additions and 20 deletions

View file

@ -1,6 +1,6 @@
use rustc_middle::traits;
use rustc_middle::ty::adjustment::CustomCoerceUnsized;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc_hir::lang_items::LangItem;
@ -8,14 +8,16 @@ pub mod collector;
pub mod partitioning;
pub mod polymorphize;
pub fn custom_coerce_unsize_info<'tcx>(
fn custom_coerce_unsize_info<'tcx>(
tcx: TyCtxt<'tcx>,
source_ty: Ty<'tcx>,
target_ty: Ty<'tcx>,
) -> CustomCoerceUnsized {
let def_id = tcx.require_lang_item(LangItem::CoerceUnsized, None);
let trait_ref = ty::Binder::bind(ty::TraitRef {
debug_assert!(!source_ty.has_escaping_bound_vars());
debug_assert!(!target_ty.has_escaping_bound_vars());
let trait_ref = ty::Binder::dummy(ty::TraitRef {
def_id,
substs: tcx.mk_substs_trait(source_ty, &[target_ty.into()]),
});