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
;
14 use std
::marker
::PhantomData
;
16 use syntax
::{attr, ast}
;
18 macro_rules
! dep_map_ty
{
19 ($ty_name
:ident
: $node_name
:ident ($key
:ty
) -> $value
:ty
) => {
20 pub struct $ty_name
<'tcx
> {
21 data
: PhantomData
<&'
tcx ()>
24 impl<'tcx
> DepTrackingMapConfig
for $ty_name
<'tcx
> {
27 fn to_dep_node(key
: &$key
) -> DepNode
<DefId
> { DepNode::$node_name(*key) }
32 dep_map_ty
! { ImplOrTraitItems: ImplOrTraitItems(DefId) -> ty::ImplOrTraitItem<'tcx> }
33 dep_map_ty
! { Tcache: ItemSignature(DefId) -> ty::TypeScheme<'tcx> }
34 dep_map_ty
! { Predicates: ItemSignature(DefId) -> ty::GenericPredicates<'tcx> }
35 dep_map_ty
! { SuperPredicates: ItemSignature(DefId) -> ty::GenericPredicates<'tcx> }
36 dep_map_ty
! { TraitItemDefIds: TraitItemDefIds(DefId) -> Rc<Vec<ty::ImplOrTraitItemId>> }
37 dep_map_ty
! { ImplTraitRefs: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>> }
38 dep_map_ty
! { TraitDefs: ItemSignature(DefId) -> &'tcx ty::TraitDef<'tcx> }
39 dep_map_ty
! { AdtDefs: ItemSignature(DefId) -> ty::AdtDefMaster<'tcx> }
40 dep_map_ty
! { ItemVariances: ItemSignature(DefId) -> Rc<ty::ItemVariances> }
41 dep_map_ty
! { InherentImpls: InherentImpls(DefId) -> Rc<Vec<DefId>> }
42 dep_map_ty
! { ImplItems: ImplItems(DefId) -> Vec<ty::ImplOrTraitItemId> }
43 dep_map_ty
! { TraitItems: TraitItems(DefId) -> Rc<Vec<ty::ImplOrTraitItem<'tcx>>> }
44 dep_map_ty
! { ReprHints: ReprHints(DefId) -> Rc<Vec<attr::ReprAttr>> }
45 dep_map_ty
! { InlinedClosures: Hir(DefId) -> ast::NodeId }