@@ -282,12 +282,33 @@ impl<'tcx> Loan<'tcx> {
282
282
}
283
283
}
284
284
285
- #[ deriving( PartialEq , Eq , Hash , Show ) ]
285
+ #[ deriving( Eq , Hash , Show ) ]
286
286
pub struct LoanPath < ' tcx > {
287
287
kind : LoanPathKind < ' tcx > ,
288
288
ty : ty:: Ty < ' tcx > ,
289
289
}
290
290
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
+
291
312
#[ deriving( PartialEq , Eq , Hash , Show ) ]
292
313
pub enum LoanPathKind < ' tcx > {
293
314
LpVar ( ast:: NodeId ) , // `x` in doc.rs
0 commit comments