Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit bcea578

Browse files
committed
Fix build
1 parent 042fc07 commit bcea578

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/mismatch.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc::{
1010
hir::def_id::DefId,
1111
ty::{
1212
self,
13-
relate::{Relate, RelateResult, TraitObjectMode, TypeRelation},
13+
relate::{Relate, RelateResult, TypeRelation},
1414
subst::Substs,
1515
Ty, TyCtxt,
1616
Visibility::Public,
@@ -95,10 +95,6 @@ impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for MismatchRelation<'a, 'gcx,
9595
"Mismatch"
9696
}
9797

98-
fn trait_object_mode(&self) -> TraitObjectMode {
99-
TraitObjectMode::NoSquash
100-
}
101-
10298
fn a_is_expected(&self) -> bool {
10399
true
104100
}
@@ -186,14 +182,17 @@ impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for MismatchRelation<'a, 'gcx,
186182
}
187183
(&TyKind::Dynamic(a_obj, a_r), &TyKind::Dynamic(b_obj, b_r)) => {
188184
let _ = self.relate(&a_r, &b_r)?;
189-
let a = a_obj.principal();
190-
let b = b_obj.principal();
191-
192-
if self.check_substs(a.skip_binder().substs, b.skip_binder().substs) {
193-
let _ = self.relate(&a.skip_binder().substs, &b.skip_binder().substs)?;
194-
Some((a.skip_binder().def_id, b.skip_binder().def_id))
195-
} else {
196-
None
185+
match (a_obj.principal(), b_obj.principal()) {
186+
(None, _) => None,
187+
(_, None) => None,
188+
(Some(a), Some(b)) => {
189+
if self.check_substs(a.skip_binder().substs, b.skip_binder().substs) {
190+
let _ = self.relate(&a.skip_binder().substs, &b.skip_binder().substs)?;
191+
Some((a.skip_binder().def_id, b.skip_binder().def_id))
192+
} else {
193+
None
194+
}
195+
}
197196
}
198197
}
199198
(&TyKind::Tuple(as_), &TyKind::Tuple(bs)) => {

0 commit comments

Comments
 (0)