mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Check other fields are consistent in LoanPath::common
.
This commit is contained in:
parent
09d67fd777
commit
21fe017ab0
@ -386,10 +386,11 @@ impl<'tcx> LoanPath<'tcx> {
|
||||
(&LpExtend(ref base, a, LpInterior(id)),
|
||||
&LpExtend(ref base2, _, LpInterior(id2))) => {
|
||||
if id == id2 {
|
||||
assert!(self.ty == other.ty);
|
||||
base.common(&**base2).map(|x| {
|
||||
let xd = x.depth();
|
||||
if base.depth() == xd && base2.depth() == xd {
|
||||
assert_eq!(base.ty, base2.ty);
|
||||
assert_eq!(self.ty, other.ty);
|
||||
LoanPath {
|
||||
kind: LpExtend(Rc::new(x), a, LpInterior(id)),
|
||||
ty: self.ty,
|
||||
@ -406,7 +407,7 @@ impl<'tcx> LoanPath<'tcx> {
|
||||
(_, &LpExtend(ref other, _, LpDeref(_))) => self.common(&**other),
|
||||
(&LpVar(id), &LpVar(id2)) => {
|
||||
if id == id2 {
|
||||
assert!(self.ty == other.ty);
|
||||
assert_eq!(self.ty, other.ty);
|
||||
Some(LoanPath { kind: LpVar(id), ty: self.ty })
|
||||
} else {
|
||||
None
|
||||
@ -414,7 +415,7 @@ impl<'tcx> LoanPath<'tcx> {
|
||||
}
|
||||
(&LpUpvar(id), &LpUpvar(id2)) => {
|
||||
if id == id2 {
|
||||
assert!(self.ty == other.ty);
|
||||
assert_eq!(self.ty, other.ty);
|
||||
Some(LoanPath { kind: LpUpvar(id), ty: self.ty })
|
||||
} else {
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user