Skip to content

Commit

Permalink
Fix breakage due to rust-lang/rust#73705
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Nov 18, 2020
1 parent be321bd commit 0c23bf0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2020-06-23
nightly-2020-07-07
32 changes: 16 additions & 16 deletions src/mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'a, 'tcx> MismatchRelation<'a, 'tcx> {
let old_ty = self.tcx.type_of(old_def_id);
let new_ty = self.tcx.type_of(new_def_id);
debug!("relating item pair");
let _ = self.relate(&old_ty, &new_ty);
let _ = self.relate(old_ty, new_ty);
}
}

Expand Down Expand Up @@ -118,13 +118,13 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
fn relate_with_variance<T: Relate<'tcx>>(
&mut self,
_: ty::Variance,
a: &T,
b: &T,
a: T,
b: T,
) -> RelateResult<'tcx, T> {
self.relate(a, b)
}

fn relate<T: Relate<'tcx>>(&mut self, a: &T, b: &T) -> RelateResult<'tcx, T> {
fn relate<T: Relate<'tcx>>(&mut self, a: T, b: T) -> RelateResult<'tcx, T> {
debug!("relate: mismatch relation: a: {:?}, b: {:?}", a, b);
Relate::relate(self, a, b)
}
Expand Down Expand Up @@ -166,7 +166,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
{
let b_field_ty = b_field.ty(self.tcx, b_substs);

let _ = self.relate(&a_field_ty, &b_field_ty)?;
let _ = self.relate(a_field_ty, b_field_ty)?;
}
}

Expand All @@ -193,16 +193,16 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
}
(&TyKind::Array(a_t, _), &TyKind::Array(b_t, _))
| (&TyKind::Slice(a_t), &TyKind::Slice(b_t)) => {
let _ = self.relate(&a_t, &b_t)?;
let _ = self.relate(a_t, b_t)?;
None
}
(&TyKind::RawPtr(a_mt), &TyKind::RawPtr(b_mt)) => {
let _ = self.relate(&a_mt, &b_mt)?;
let _ = self.relate(a_mt, b_mt)?;
None
}
(&TyKind::Ref(a_r, a_ty, _), &TyKind::Ref(b_r, b_ty, _)) => {
let _ = self.relate(&a_r, &b_r)?;
let _ = self.relate(&a_ty, &b_ty)?;
let _ = self.relate(a_r, b_r)?;
let _ = self.relate(a_ty, b_ty)?;
None
}
(&TyKind::FnDef(a_def_id, a_substs), &TyKind::FnDef(b_def_id, b_substs)) => {
Expand All @@ -219,17 +219,17 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
Some((a, b))
}
(&TyKind::FnPtr(a_fty), &TyKind::FnPtr(b_fty)) => {
let _ = self.relate(&a_fty, &b_fty)?;
let _ = self.relate(a_fty, b_fty)?;
None
}
(&TyKind::Dynamic(a_obj, a_r), &TyKind::Dynamic(b_obj, b_r)) => {
let _ = self.relate(&a_r, &b_r)?;
let _ = self.relate(a_r, b_r)?;
let a = a_obj.principal();
let b = b_obj.principal();

if let (Some(a), Some(b)) = (a, b) {
if self.check_substs(a.skip_binder().substs, b.skip_binder().substs) {
let _ = self.relate(&a.skip_binder().substs, &b.skip_binder().substs)?;
let _ = self.relate(a.skip_binder().substs, b.skip_binder().substs)?;
let a = Res::Def(DefKind::Trait, a.skip_binder().def_id);
let b = Res::Def(DefKind::Trait, b.skip_binder().def_id);
Some((a, b))
Expand All @@ -241,11 +241,11 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
}
}
(&TyKind::Tuple(as_), &TyKind::Tuple(bs)) => {
let _ = as_.iter().zip(bs).map(|(a, b)| self.relate(&a, &b));
let _ = as_.iter().zip(bs).map(|(a, b)| self.relate(a, b));
None
}
(&TyKind::Projection(a_data), &TyKind::Projection(b_data)) => {
let _ = self.relate(&a_data, &b_data)?;
let _ = self.relate(a_data, b_data)?;

let a = Res::Def(DefKind::AssocTy, a_data.item_def_id);
let b = Res::Def(DefKind::AssocTy, b_data.item_def_id);
Expand Down Expand Up @@ -305,8 +305,8 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {

fn binders<T: Relate<'tcx>>(
&mut self,
a: &ty::Binder<T>,
b: &ty::Binder<T>,
a: ty::Binder<T>,
b: ty::Binder<T>,
) -> RelateResult<'tcx, ty::Binder<T>> {
Ok(ty::Binder::bind(
self.relate(a.skip_binder(), b.skip_binder())?,
Expand Down
2 changes: 1 addition & 1 deletion src/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
let res: Vec<_> = preds
.iter()
.map(|p| {
match *p.skip_binder() {
match p.skip_binder() {
Trait(existential_trait_ref) => {
let trait_ref = Binder::bind(existential_trait_ref)
.with_self_ty(self.tcx, dummy_self);
Expand Down

0 comments on commit 0c23bf0

Please sign in to comment.