Skip to content

Commit 21fe017

Browse files
committed
Check other fields are consistent in LoanPath::common.
1 parent 09d67fd commit 21fe017

File tree

1 file changed

+4
-3
lines changed
  • src/librustc/middle/borrowck

1 file changed

+4
-3
lines changed

src/librustc/middle/borrowck/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,11 @@ impl<'tcx> LoanPath<'tcx> {
386386
(&LpExtend(ref base, a, LpInterior(id)),
387387
&LpExtend(ref base2, _, LpInterior(id2))) => {
388388
if id == id2 {
389-
assert!(self.ty == other.ty);
390389
base.common(&**base2).map(|x| {
391390
let xd = x.depth();
392391
if base.depth() == xd && base2.depth() == xd {
392+
assert_eq!(base.ty, base2.ty);
393+
assert_eq!(self.ty, other.ty);
393394
LoanPath {
394395
kind: LpExtend(Rc::new(x), a, LpInterior(id)),
395396
ty: self.ty,
@@ -406,15 +407,15 @@ impl<'tcx> LoanPath<'tcx> {
406407
(_, &LpExtend(ref other, _, LpDeref(_))) => self.common(&**other),
407408
(&LpVar(id), &LpVar(id2)) => {
408409
if id == id2 {
409-
assert!(self.ty == other.ty);
410+
assert_eq!(self.ty, other.ty);
410411
Some(LoanPath { kind: LpVar(id), ty: self.ty })
411412
} else {
412413
None
413414
}
414415
}
415416
(&LpUpvar(id), &LpUpvar(id2)) => {
416417
if id == id2 {
417-
assert!(self.ty == other.ty);
418+
assert_eq!(self.ty, other.ty);
418419
Some(LoanPath { kind: LpUpvar(id), ty: self.ty })
419420
} else {
420421
None

0 commit comments

Comments
 (0)