Skip to content

Commit dd91ad7

Browse files
committed
---
yaml --- r: 160660 b: refs/heads/master c: 6f7cb8c h: refs/heads/master v: v3
1 parent 32f4736 commit dd91ad7

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1217b829e85ec4720ba9a1c43c173d4015eae651
2+
refs/heads/master: 6f7cb8c6185878d6e4ad0cf354652158a73c0b72
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c9f6d696420107f82304b992cf623b806995fe18
55
refs/heads/try: 225de0d60f8ca8dcc62ab2fd8818ebbda4b58cfe

trunk/src/librustc/middle/borrowck/mod.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,33 @@ impl<'tcx> Loan<'tcx> {
282282
}
283283
}
284284

285-
#[deriving(PartialEq, Eq, Hash, Show)]
285+
#[deriving(Eq, Hash, Show)]
286286
pub struct LoanPath<'tcx> {
287287
kind: LoanPathKind<'tcx>,
288288
ty: ty::Ty<'tcx>,
289289
}
290290

291+
impl<'tcx> LoanPath<'tcx> {
292+
pub fn eq_debug(&self, that: &LoanPath<'tcx>, tcx: &ty::ctxt<'tcx>) -> bool {
293+
let r = self.kind == that.kind;
294+
if r && self.ty != that.ty {
295+
panic!("eq variants ineq types: {} == {}, {} != {}",
296+
self.repr(tcx), that.repr(tcx),
297+
self.ty.repr(tcx), that.ty.repr(tcx));
298+
}
299+
r
300+
}
301+
}
302+
303+
impl<'tcx> PartialEq for LoanPath<'tcx> {
304+
fn eq(&self, that: &LoanPath<'tcx>) -> bool {
305+
let r = self.kind == that.kind;
306+
debug_assert!(self.ty == that.ty || !r,
307+
"Somehow loan paths are equal though their tys are not.");
308+
r
309+
}
310+
}
311+
291312
#[deriving(PartialEq, Eq, Hash, Show)]
292313
pub enum LoanPathKind<'tcx> {
293314
LpVar(ast::NodeId), // `x` in doc.rs

0 commit comments

Comments
 (0)