Skip to content

Commit d21a742

Browse files
committed
---
yaml --- r: 162595 b: refs/heads/try c: 6f7cb8c h: refs/heads/master i: 162593: a26087d 162591: 939c1d3 v: v3
1 parent 18eb58b commit d21a742

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cafe2966770ff377aad6dd9fd808e68055587c58
5-
refs/heads/try: 1217b829e85ec4720ba9a1c43c173d4015eae651
5+
refs/heads/try: 6f7cb8c6185878d6e4ad0cf354652158a73c0b72
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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)