1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use hir::def_id::DefId;
13 use util::nodemap::DefIdMap;
15 pub struct DefPathHashes<'a, 'tcx: 'a> {
16 tcx: TyCtxt<'a, 'tcx, 'tcx>,
20 impl<'a, 'tcx> DefPathHashes<'a, 'tcx> {
21 pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
28 pub fn hash(&mut self, def_id: DefId) -> u64 {
30 *self.data.entry(def_id)
32 let def_path = tcx.def_path(def_id);
33 def_path.deterministic_hash(tcx)