1 // Copyright 2012-2015 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 dep_graph
::{DepNode, DepTrackingMapConfig}
;
12 use hir
::def_id
::DefId
;
16 use std
::cell
::RefCell
;
17 use std
::marker
::PhantomData
;
19 use syntax
::{attr, ast}
;
21 macro_rules
! dep_map_ty
{
22 ($ty_name
:ident
: $node_name
:ident ($key
:ty
) -> $value
:ty
) => {
23 pub struct $ty_name
<'tcx
> {
24 data
: PhantomData
<&'
tcx ()>
27 impl<'tcx
> DepTrackingMapConfig
for $ty_name
<'tcx
> {
30 fn to_dep_node(key
: &$key
) -> DepNode
<DefId
> { DepNode::$node_name(*key) }
35 dep_map_ty
! { ImplOrTraitItems: ImplOrTraitItems(DefId) -> ty::ImplOrTraitItem<'tcx> }
36 dep_map_ty
! { Tcache: ItemSignature(DefId) -> Ty<'tcx> }
37 dep_map_ty
! { Generics: ItemSignature(DefId) -> &'tcx ty::Generics<'tcx> }
38 dep_map_ty
! { Predicates: ItemSignature(DefId) -> ty::GenericPredicates<'tcx> }
39 dep_map_ty
! { SuperPredicates: ItemSignature(DefId) -> ty::GenericPredicates<'tcx> }
40 dep_map_ty
! { ImplOrTraitItemDefIds: ImplOrTraitItemDefIds(DefId) -> Rc<Vec<DefId>> }
41 dep_map_ty
! { ImplTraitRefs: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>> }
42 dep_map_ty
! { TraitDefs: ItemSignature(DefId) -> &'tcx ty::TraitDef<'tcx> }
43 dep_map_ty
! { AdtDefs: ItemSignature(DefId) -> ty::AdtDefMaster<'tcx> }
44 dep_map_ty
! { ItemVariances: ItemSignature(DefId) -> Rc<Vec<ty::Variance>> }
45 dep_map_ty
! { InherentImpls: InherentImpls(DefId) -> Vec<DefId> }
46 dep_map_ty
! { TraitItems: TraitItems(DefId) -> Rc<Vec<ty::ImplOrTraitItem<'tcx>>> }
47 dep_map_ty
! { ReprHints: ReprHints(DefId) -> Rc<Vec<attr::ReprAttr>> }
48 dep_map_ty
! { InlinedClosures: Hir(DefId) -> ast::NodeId }
49 dep_map_ty
! { Mir: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>> }