Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -345,18 +346,21 @@ impl<'tcx> Loan<'tcx> {
}
}

#[derive(Eq, Hash)]
#[derive(Eq)]
pub struct LoanPath<'tcx> {
kind: LoanPathKind<'tcx>,
ty: ty::Ty<'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);
}
}

Expand Down