fix various subst_identity vs skip_binder
This commit is contained in:
parent
f29a334c90
commit
6e969ea85e
13 changed files with 29 additions and 25 deletions
|
@ -77,10 +77,10 @@ pub fn overlapping_impls(
|
|||
// a quick check via fast_reject to tell if the impl headers could possibly
|
||||
// unify.
|
||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::AsInfer };
|
||||
let impl1_ref = tcx.impl_trait_ref(impl1_def_id).map(ty::EarlyBinder::subst_identity);
|
||||
let impl2_ref = tcx.impl_trait_ref(impl2_def_id).map(ty::EarlyBinder::subst_identity);
|
||||
let impl1_ref = tcx.impl_trait_ref(impl1_def_id);
|
||||
let impl2_ref = tcx.impl_trait_ref(impl2_def_id);
|
||||
let may_overlap = match (impl1_ref, impl2_ref) {
|
||||
(Some(a), Some(b)) => iter::zip(a.substs, b.substs)
|
||||
(Some(a), Some(b)) => iter::zip(a.skip_binder().substs, b.skip_binder().substs)
|
||||
.all(|(arg1, arg2)| drcx.generic_args_may_unify(arg1, arg2)),
|
||||
(None, None) => {
|
||||
let self_ty1 = tcx.type_of(impl1_def_id);
|
||||
|
@ -461,7 +461,7 @@ pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanChe
|
|||
|
||||
// We only except this routine to be invoked on implementations
|
||||
// of a trait, not inherent implementations.
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().skip_binder();
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().subst_identity();
|
||||
debug!("orphan_check: trait_ref={:?}", trait_ref);
|
||||
|
||||
// If the *trait* is local to the crate, ok.
|
||||
|
|
|
@ -1940,7 +1940,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
return None;
|
||||
}
|
||||
|
||||
let imp = self.tcx.impl_trait_ref(def_id).unwrap().subst_identity();
|
||||
let imp = self.tcx.impl_trait_ref(def_id).unwrap().skip_binder();
|
||||
|
||||
self.fuzzy_match_tys(trait_pred.skip_binder().self_ty(), imp.self_ty(), false)
|
||||
.map(|similarity| ImplCandidate { trait_ref: imp, similarity })
|
||||
|
|
|
@ -431,7 +431,7 @@ fn report_conflicting_impls<'tcx>(
|
|||
pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Option<String> {
|
||||
use std::fmt::Write;
|
||||
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id)?.skip_binder();
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id)?.subst_identity();
|
||||
let mut w = "impl".to_owned();
|
||||
|
||||
let substs = InternalSubsts::identity_for_item(tcx, impl_def_id);
|
||||
|
|
|
@ -48,7 +48,7 @@ trait ChildrenExt<'tcx> {
|
|||
impl<'tcx> ChildrenExt<'tcx> for Children {
|
||||
/// Insert an impl into this set of children without comparing to any existing impls.
|
||||
fn insert_blindly(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) {
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().subst_identity();
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().skip_binder();
|
||||
if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), TreatParams::AsInfer)
|
||||
{
|
||||
debug!("insert_blindly: impl_def_id={:?} st={:?}", impl_def_id, st);
|
||||
|
@ -63,7 +63,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
|
|||
/// an impl with a parent. The impl must be present in the list of
|
||||
/// children already.
|
||||
fn remove_existing(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) {
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().subst_identity();
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().skip_binder();
|
||||
let vec: &mut Vec<DefId>;
|
||||
if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), TreatParams::AsInfer)
|
||||
{
|
||||
|
@ -275,7 +275,8 @@ impl<'tcx> GraphExt<'tcx> for Graph {
|
|||
) -> Result<Option<FutureCompatOverlapError<'tcx>>, OverlapError<'tcx>> {
|
||||
assert!(impl_def_id.is_local());
|
||||
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().subst_identity();
|
||||
// FIXME: use `EarlyBinder` in `self.children`
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().skip_binder();
|
||||
let trait_def_id = trait_ref.def_id;
|
||||
|
||||
debug!(
|
||||
|
@ -388,7 +389,7 @@ pub(crate) fn assoc_def(
|
|||
impl_def_id: DefId,
|
||||
assoc_def_id: DefId,
|
||||
) -> Result<LeafDef, ErrorGuaranteed> {
|
||||
let trait_def_id = tcx.impl_trait_ref(impl_def_id).unwrap().skip_binder().def_id;
|
||||
let trait_def_id = tcx.trait_id_of_impl(impl_def_id).unwrap();
|
||||
let trait_def = tcx.trait_def(trait_def_id);
|
||||
|
||||
// This function may be called while we are still building the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue