Skip to content

Commit 14b4d72

Browse files
committed
rustc_borrowck: Don't hash types in loan paths
1 parent 71bdeea commit 14b4d72

File tree

1 file changed

+9
-5
lines changed
  • src/librustc_borrowck/borrowck

1 file changed

+9
-5
lines changed

src/librustc_borrowck/borrowck/mod.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ use rustc::ty::{self, TyCtxt};
4141
use std::fmt;
4242
use std::mem;
4343
use std::rc::Rc;
44+
use std::hash::{Hash, Hasher};
4445
use syntax::ast;
4546
use syntax::attr::AttrMetaMethods;
4647
use syntax_pos::{MultiSpan, Span};
@@ -345,18 +346,21 @@ impl<'tcx> Loan<'tcx> {
345346
}
346347
}
347348

348-
#[derive(Eq, Hash)]
349+
#[derive(Eq)]
349350
pub struct LoanPath<'tcx> {
350351
kind: LoanPathKind<'tcx>,
351352
ty: ty::Ty<'tcx>,
352353
}
353354

354355
impl<'tcx> PartialEq for LoanPath<'tcx> {
355356
fn eq(&self, that: &LoanPath<'tcx>) -> bool {
356-
let r = self.kind == that.kind;
357-
debug_assert!(self.ty == that.ty || !r,
358-
"Somehow loan paths are equal though their tys are not.");
359-
r
357+
self.kind == that.kind
358+
}
359+
}
360+
361+
impl<'tcx> Hash for LoanPath<'tcx> {
362+
fn hash<H: Hasher>(&self, state: &mut H) {
363+
self.kind.hash(state);
360364
}
361365
}
362366

0 commit comments

Comments
 (0)