diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-08-24 21:10:19 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-08-26 01:15:45 +0300 |
| commit | 14b4d72e01708a82e3d070f72ac87988f08df7da (patch) | |
| tree | 8464b558270e3688aac1596362a186ce37d7c1ad | |
| parent | 71bdeea561355ba5adbc9a1f44f4f866a75a15c4 (diff) | |
| download | rust-14b4d72e01708a82e3d070f72ac87988f08df7da.tar.gz rust-14b4d72e01708a82e3d070f72ac87988f08df7da.zip | |
rustc_borrowck: Don't hash types in loan paths
| -rw-r--r-- | src/librustc_borrowck/borrowck/mod.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 225895adefa..9ab6aaa9563 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -41,6 +41,7 @@ use rustc::ty::{self, TyCtxt}; use std::fmt; use std::mem; use std::rc::Rc; +use std::hash::{Hash, Hasher}; use syntax::ast; use syntax::attr::AttrMetaMethods; use syntax_pos::{MultiSpan, Span}; @@ -345,7 +346,7 @@ impl<'tcx> Loan<'tcx> { } } -#[derive(Eq, Hash)] +#[derive(Eq)] pub struct LoanPath<'tcx> { kind: LoanPathKind<'tcx>, ty: ty::Ty<'tcx>, @@ -353,10 +354,13 @@ pub struct LoanPath<'tcx> { impl<'tcx> PartialEq for LoanPath<'tcx> { fn eq(&self, that: &LoanPath<'tcx>) -> bool { - let r = self.kind == that.kind; - debug_assert!(self.ty == that.ty || !r, - "Somehow loan paths are equal though their tys are not."); - r + self.kind == that.kind + } +} + +impl<'tcx> Hash for LoanPath<'tcx> { + fn hash<H: Hasher>(&self, state: &mut H) { + self.kind.hash(state); } } |
