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::{DepGraph, DepNode, DepTrackingMap, DepTrackingMapConfig};
12 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
15 use middle::const_val;
16 use middle::privacy::AccessLevels;
17 use middle::region::RegionMaps;
19 use mir::transform::{MirSuite, MirPassIndex};
20 use session::CompileResult;
21 use ty::{self, CrateInherentImpls, Ty, TyCtxt};
24 use ty::subst::Substs;
25 use util::nodemap::{DefIdSet, NodeSet};
27 use rustc_data_structures::indexed_vec::IndexVec;
28 use std::cell::{RefCell, RefMut};
32 use std::collections::BTreeMap;
35 use syntax_pos::{Span, DUMMY_SP};
37 use syntax::symbol::Symbol;
39 pub trait Key: Clone + Hash + Eq + Debug {
40 fn map_crate(&self) -> CrateNum;
41 fn default_span(&self, tcx: TyCtxt) -> Span;
44 impl<'tcx> Key for ty::InstanceDef<'tcx> {
45 fn map_crate(&self) -> CrateNum {
49 fn default_span(&self, tcx: TyCtxt) -> Span {
50 tcx.def_span(self.def_id())
54 impl<'tcx> Key for ty::Instance<'tcx> {
55 fn map_crate(&self) -> CrateNum {
59 fn default_span(&self, tcx: TyCtxt) -> Span {
60 tcx.def_span(self.def_id())
64 impl Key for CrateNum {
65 fn map_crate(&self) -> CrateNum {
68 fn default_span(&self, _: TyCtxt) -> Span {
74 fn map_crate(&self) -> CrateNum {
77 fn default_span(&self, tcx: TyCtxt) -> Span {
82 impl Key for (DefId, DefId) {
83 fn map_crate(&self) -> CrateNum {
86 fn default_span(&self, tcx: TyCtxt) -> Span {
87 self.1.default_span(tcx)
91 impl Key for (CrateNum, DefId) {
92 fn map_crate(&self) -> CrateNum {
95 fn default_span(&self, tcx: TyCtxt) -> Span {
96 self.1.default_span(tcx)
100 impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
101 fn map_crate(&self) -> CrateNum {
104 fn default_span(&self, tcx: TyCtxt) -> Span {
105 self.0.default_span(tcx)
109 impl Key for (MirSuite, DefId) {
110 fn map_crate(&self) -> CrateNum {
113 fn default_span(&self, tcx: TyCtxt) -> Span {
114 self.1.default_span(tcx)
118 impl Key for (MirSuite, MirPassIndex, DefId) {
119 fn map_crate(&self) -> CrateNum {
122 fn default_span(&self, tcx: TyCtxt) -> Span {
123 self.2.default_span(tcx)
127 trait Value<'tcx>: Sized {
128 fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self;
131 impl<'tcx, T> Value<'tcx> for T {
132 default fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> T {
133 tcx.sess.abort_if_errors();
134 bug!("Value::from_cycle_error called without errors");
138 impl<'tcx, T: Default> Value<'tcx> for T {
139 default fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> T {
144 impl<'tcx> Value<'tcx> for Ty<'tcx> {
145 fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> {
150 impl<'tcx> Value<'tcx> for ty::DtorckConstraint<'tcx> {
151 fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
156 impl<'tcx> Value<'tcx> for ty::SymbolName {
157 fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
158 ty::SymbolName { name: Symbol::intern("<error>").as_str() }
162 pub struct CycleError<'a, 'tcx: 'a> {
164 cycle: RefMut<'a, [(Span, Query<'tcx>)]>,
167 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
168 pub fn report_cycle(self, CycleError { span, cycle }: CycleError) {
169 // Subtle: release the refcell lock before invoking `describe()`
170 // below by dropping `cycle`.
171 let stack = cycle.to_vec();
174 assert!(!stack.is_empty());
176 // Disable naming impls with types in this path, since that
177 // sometimes cycles itself, leading to extra cycle errors.
178 // (And cycle errors around impls tend to occur during the
179 // collect/coherence phases anyhow.)
180 item_path::with_forced_impl_filename_line(|| {
182 struct_span_err!(self.sess, span, E0391,
183 "unsupported cyclic reference between types/traits detected");
184 err.span_label(span, &format!("cyclic reference"));
186 err.span_note(stack[0].0, &format!("the cycle begins when {}...",
187 stack[0].1.describe(self)));
189 for &(span, ref query) in &stack[1..] {
190 err.span_note(span, &format!("...which then requires {}...",
191 query.describe(self)));
194 err.note(&format!("...which then again requires {}, completing the cycle.",
195 stack[0].1.describe(self)));
201 fn cycle_check<F, R>(self, span: Span, query: Query<'gcx>, compute: F)
202 -> Result<R, CycleError<'a, 'gcx>>
203 where F: FnOnce() -> R
206 let mut stack = self.maps.query_stack.borrow_mut();
207 if let Some((i, _)) = stack.iter().enumerate().rev()
208 .find(|&(_, &(_, ref q))| *q == query) {
209 return Err(CycleError {
211 cycle: RefMut::map(stack, |stack| &mut stack[i..])
214 stack.push((span, query));
217 let result = compute();
219 self.maps.query_stack.borrow_mut().pop();
225 trait QueryDescription: DepTrackingMapConfig {
226 fn describe(tcx: TyCtxt, key: Self::Key) -> String;
229 impl<M: DepTrackingMapConfig<Key=DefId>> QueryDescription for M {
230 default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
231 format!("processing `{}`", tcx.item_path_str(def_id))
235 impl<'tcx> QueryDescription for queries::super_predicates_of<'tcx> {
236 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
237 format!("computing the supertraits of `{}`",
238 tcx.item_path_str(def_id))
242 impl<'tcx> QueryDescription for queries::type_param_predicates<'tcx> {
243 fn describe(tcx: TyCtxt, (_, def_id): (DefId, DefId)) -> String {
244 let id = tcx.hir.as_local_node_id(def_id).unwrap();
245 format!("computing the bounds for type parameter `{}`",
246 tcx.hir.ty_param_name(id))
250 impl<'tcx> QueryDescription for queries::coherent_trait<'tcx> {
251 fn describe(tcx: TyCtxt, (_, def_id): (CrateNum, DefId)) -> String {
252 format!("coherence checking all impls of trait `{}`",
253 tcx.item_path_str(def_id))
257 impl<'tcx> QueryDescription for queries::crate_inherent_impls<'tcx> {
258 fn describe(_: TyCtxt, k: CrateNum) -> String {
259 format!("all inherent impls defined in crate `{:?}`", k)
263 impl<'tcx> QueryDescription for queries::crate_inherent_impls_overlap_check<'tcx> {
264 fn describe(_: TyCtxt, _: CrateNum) -> String {
265 format!("check for overlap between inherent impls defined in this crate")
269 impl<'tcx> QueryDescription for queries::crate_variances<'tcx> {
270 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
271 format!("computing the variances for items in this crate")
275 impl<'tcx> QueryDescription for queries::mir_shims<'tcx> {
276 fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
277 format!("generating MIR shim for `{}`",
278 tcx.item_path_str(def.def_id()))
282 impl<'tcx> QueryDescription for queries::privacy_access_levels<'tcx> {
283 fn describe(_: TyCtxt, _: CrateNum) -> String {
284 format!("privacy access levels")
288 impl<'tcx> QueryDescription for queries::typeck_item_bodies<'tcx> {
289 fn describe(_: TyCtxt, _: CrateNum) -> String {
290 format!("type-checking all item bodies")
294 impl<'tcx> QueryDescription for queries::reachable_set<'tcx> {
295 fn describe(_: TyCtxt, _: CrateNum) -> String {
296 format!("reachability")
300 impl<'tcx> QueryDescription for queries::const_eval<'tcx> {
301 fn describe(tcx: TyCtxt, (def_id, _): (DefId, &'tcx Substs<'tcx>)) -> String {
302 format!("const-evaluating `{}`", tcx.item_path_str(def_id))
306 impl<'tcx> QueryDescription for queries::mir_keys<'tcx> {
307 fn describe(_: TyCtxt, _: CrateNum) -> String {
308 format!("getting a list of all mir_keys")
312 impl<'tcx> QueryDescription for queries::symbol_name<'tcx> {
313 fn describe(_tcx: TyCtxt, instance: ty::Instance<'tcx>) -> String {
314 format!("computing the symbol for `{}`", instance)
318 impl<'tcx> QueryDescription for queries::describe_def<'tcx> {
319 fn describe(_: TyCtxt, _: DefId) -> String {
324 impl<'tcx> QueryDescription for queries::def_span<'tcx> {
325 fn describe(_: TyCtxt, _: DefId) -> String {
331 impl<'tcx> QueryDescription for queries::stability<'tcx> {
332 fn describe(_: TyCtxt, _: DefId) -> String {
337 impl<'tcx> QueryDescription for queries::deprecation<'tcx> {
338 fn describe(_: TyCtxt, _: DefId) -> String {
343 impl<'tcx> QueryDescription for queries::item_body_nested_bodies<'tcx> {
344 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
345 format!("nested item bodies of `{}`", tcx.item_path_str(def_id))
349 impl<'tcx> QueryDescription for queries::const_is_rvalue_promotable_to_static<'tcx> {
350 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
351 format!("const checking if rvalue is promotable to static `{}`",
352 tcx.item_path_str(def_id))
356 impl<'tcx> QueryDescription for queries::is_mir_available<'tcx> {
357 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
358 format!("checking if item is mir available: `{}`",
359 tcx.item_path_str(def_id))
363 macro_rules! define_maps {
366 [$($modifiers:tt)*] $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
369 input: ($(([$($modifiers)*] [$($attr)*] [$name]))*)
372 impl<$tcx> Maps<$tcx> {
373 pub fn new(dep_graph: DepGraph,
374 providers: IndexVec<CrateNum, Providers<$tcx>>)
378 query_stack: RefCell::new(vec![]),
379 $($name: RefCell::new(DepTrackingMap::new(dep_graph.clone()))),*
385 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
386 pub enum Query<$tcx> {
387 $($(#[$attr])* $name($K)),*
390 impl<$tcx> Query<$tcx> {
391 pub fn describe(&self, tcx: TyCtxt) -> String {
393 $(Query::$name(key) => queries::$name::describe(tcx, key)),*
399 use std::marker::PhantomData;
401 $(#[allow(bad_style)]
402 pub struct $name<$tcx> {
403 data: PhantomData<&$tcx ()>
407 $(impl<$tcx> DepTrackingMapConfig for queries::$name<$tcx> {
412 fn to_dep_node(key: &$K) -> DepNode<DefId> {
413 use dep_graph::DepNode::*;
418 impl<'a, $tcx, 'lcx> queries::$name<$tcx> {
419 fn try_get_with<F, R>(tcx: TyCtxt<'a, $tcx, 'lcx>,
423 -> Result<R, CycleError<'a, $tcx>>
424 where F: FnOnce(&$V) -> R
426 debug!("ty::queries::{}::try_get_with(key={:?}, span={:?})",
431 if let Some(result) = tcx.maps.$name.borrow().get(&key) {
432 return Ok(f(result));
435 // FIXME(eddyb) Get more valid Span's on queries.
436 // def_span guard is necesary to prevent a recursive loop,
437 // default_span calls def_span query internally.
438 if span == DUMMY_SP && stringify!($name) != "def_span" {
439 span = key.default_span(tcx)
442 let _task = tcx.dep_graph.in_task(Self::to_dep_node(&key));
444 let result = tcx.cycle_check(span, Query::$name(key), || {
445 let provider = tcx.maps.providers[key.map_crate()].$name;
446 provider(tcx.global_tcx(), key)
449 Ok(f(tcx.maps.$name.borrow_mut().entry(key).or_insert(result)))
452 pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
453 -> Result<$V, CycleError<'a, $tcx>> {
454 Self::try_get_with(tcx, span, key, Clone::clone)
457 pub fn force(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K) {
458 // FIXME(eddyb) Move away from using `DepTrackingMap`
459 // so we don't have to explicitly ignore a false edge:
460 // we can't observe a value dependency, only side-effects,
461 // through `force`, and once everything has been updated,
462 // perhaps only diagnostics, if those, will remain.
463 let _ignore = tcx.dep_graph.in_ignore();
464 match Self::try_get_with(tcx, span, key, |_| ()) {
466 Err(e) => tcx.report_cycle(e)
471 #[derive(Copy, Clone)]
472 pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
473 pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
477 impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> {
478 type Target = TyCtxt<'a, 'gcx, 'tcx>;
479 fn deref(&self) -> &Self::Target {
484 impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> {
485 /// Return a transparent wrapper for `TyCtxt` which uses
486 /// `span` as the location of queries performed through it.
487 pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> {
495 pub fn $name(self, key: $K) -> $V {
496 self.at(DUMMY_SP).$name(key)
500 impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
502 pub fn $name(self, key: $K) -> $V {
503 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|e| {
504 self.report_cycle(e);
505 Value::from_cycle_error(self.global_tcx())
510 define_provider_struct! {
512 input: ($(([$($modifiers)*] [$name] [$K] [$V]))*),
516 impl<$tcx> Copy for Providers<$tcx> {}
517 impl<$tcx> Clone for Providers<$tcx> {
518 fn clone(&self) -> Self { *self }
523 macro_rules! define_map_struct {
526 input: $input:tt) => {
537 output: ($($output:tt)*)) => {
538 pub struct Maps<$tcx> {
539 providers: IndexVec<CrateNum, Providers<$tcx>>,
540 query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
545 // Field recognized and ready to shift into the output
547 ready: ([$($pub:tt)*] [$($attr:tt)*] [$name:ident]),
549 output: ($($output:tt)*)) => {
554 $(#[$attr])* $($pub)* $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>,)
558 // No modifiers left? This is a private item.
560 input: (([] $attrs:tt $name:tt) $($input:tt)*),
561 output: $output:tt) => {
564 ready: ([pub] $attrs $name),
570 // Skip other modifiers
572 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
573 output: $output:tt) => {
576 input: (([$($modifiers)*] $($fields)*) $($input)*),
582 macro_rules! define_provider_struct {
584 (tcx: $tcx:tt, input: $input:tt) => {
585 define_provider_struct! {
595 output: ($(([$name:ident] [$K:ty] [$R:ty]))*)) => {
596 pub struct Providers<$tcx> {
597 $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $R,)*
600 impl<$tcx> Default for Providers<$tcx> {
601 fn default() -> Self {
602 $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
603 bug!("tcx.maps.{}({:?}) unsupported by its crate",
604 stringify!($name), key);
606 Providers { $($name),* }
611 // Something ready to shift:
613 ready: ($name:tt $K:tt $V:tt),
615 output: ($($output:tt)*)) => {
616 define_provider_struct! {
619 output: ($($output)* ($name $K $V))
623 // Regular queries produce a `V` only.
625 input: (([] $name:tt $K:tt $V:tt) $($input:tt)*),
626 output: $output:tt) => {
627 define_provider_struct! {
629 ready: ($name $K $V),
637 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
638 output: $output:tt) => {
639 define_provider_struct! {
641 input: (([$($modifiers)*] $($fields)*) $($input)*),
647 // Each of these maps also corresponds to a method on a
648 // `Provider` trait for requesting a value of that type,
649 // and a method on `Maps` itself for doing that in a
650 // a way that memoizes and does dep-graph tracking,
651 // wrapping around the actual chain of providers that
652 // the driver creates (using several `rustc_*` crates).
653 define_maps! { <'tcx>
654 /// Records the type of every item.
655 [] type_of: ItemSignature(DefId) -> Ty<'tcx>,
657 /// Maps from the def-id of an item (trait/struct/enum/fn) to its
658 /// associated generics and predicates.
659 [] generics_of: ItemSignature(DefId) -> &'tcx ty::Generics,
660 [] predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
662 /// Maps from the def-id of a trait to the list of
663 /// super-predicates. This is a subset of the full list of
664 /// predicates. We store these in a separate map because we must
665 /// evaluate them even during type conversion, often before the
666 /// full predicates are available (note that supertraits have
667 /// additional acyclicity requirements).
668 [] super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
670 /// To avoid cycles within the predicates of a single item we compute
671 /// per-type-parameter predicates for resolving `T::AssocTy`.
672 [] type_param_predicates: TypeParamPredicates((DefId, DefId))
673 -> ty::GenericPredicates<'tcx>,
675 [] trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
676 [] adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
677 [] adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
678 [] adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
679 [] adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
681 /// True if this is a foreign item (i.e., linked via `extern { ... }`).
682 [] is_foreign_item: IsForeignItem(DefId) -> bool,
684 /// Get a map with the variance of every item; use `item_variance`
686 [] crate_variances: crate_variances(CrateNum) -> Rc<ty::CrateVariancesMap>,
688 /// Maps from def-id of a type or region parameter to its
689 /// (inferred) variance.
690 [] variances_of: ItemVariances(DefId) -> Rc<Vec<ty::Variance>>,
692 /// Maps from an impl/trait def-id to a list of the def-ids of its items
693 [] associated_item_def_ids: AssociatedItemDefIds(DefId) -> Rc<Vec<DefId>>,
695 /// Maps from a trait item to the trait item "descriptor"
696 [] associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
698 [] impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
699 [] impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
701 /// Maps a DefId of a type to a list of its inherent impls.
702 /// Contains implementations of methods that are inherent to a type.
703 /// Methods in these implementations don't need to be exported.
704 [] inherent_impls: InherentImpls(DefId) -> Rc<Vec<DefId>>,
706 /// Set of all the def-ids in this crate that have MIR associated with
707 /// them. This includes all the body owners, but also things like struct
709 [] mir_keys: mir_keys(CrateNum) -> Rc<DefIdSet>,
711 /// Maps DefId's that have an associated Mir to the result
712 /// of the MIR qualify_consts pass. The actual meaning of
713 /// the value isn't known except to the pass itself.
714 [] mir_const_qualif: Mir(DefId) -> u8,
716 /// Fetch the MIR for a given def-id up till the point where it is
717 /// ready for const evaluation.
719 /// See the README for the `mir` module for details.
720 [] mir_const: Mir(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
722 [] mir_validated: Mir(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
724 /// MIR after our optimization passes have run. This is MIR that is ready
725 /// for trans. This is also the only query that can fetch non-local MIR, at present.
726 [] optimized_mir: Mir(DefId) -> &'tcx mir::Mir<'tcx>,
728 /// Records the type of each closure. The def ID is the ID of the
729 /// expression defining the closure.
730 [] closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
732 /// Records the type of each closure. The def ID is the ID of the
733 /// expression defining the closure.
734 [] closure_type: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
736 /// Caches CoerceUnsized kinds for impls on custom types.
737 [] coerce_unsized_info: ItemSignature(DefId)
738 -> ty::adjustment::CoerceUnsizedInfo,
740 [] typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
742 [] typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
744 [] has_typeck_tables: TypeckTables(DefId) -> bool,
746 [] coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
748 [] borrowck: BorrowCheck(DefId) -> (),
750 /// Gets a complete map from all types to their inherent impls.
751 /// Not meant to be used directly outside of coherence.
752 /// (Defined only for LOCAL_CRATE)
753 [] crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
755 /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
756 /// Not meant to be used directly outside of coherence.
757 /// (Defined only for LOCAL_CRATE)
758 [] crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node(CrateNum) -> (),
760 /// Results of evaluating const items or constants embedded in
761 /// other items (such as enum variant explicit discriminants).
762 [] const_eval: const_eval_dep_node((DefId, &'tcx Substs<'tcx>))
763 -> const_val::EvalResult<'tcx>,
765 /// Performs the privacy check and computes "access levels".
766 [] privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Rc<AccessLevels>,
768 [] reachable_set: reachability_dep_node(CrateNum) -> Rc<NodeSet>,
770 /// Per-function `RegionMaps`. The `DefId` should be the owner-def-id for the fn body;
771 /// in the case of closures or "inline" expressions, this will be redirected to the enclosing
773 [] region_maps: RegionMaps(DefId) -> Rc<RegionMaps<'tcx>>,
775 [] mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx>,
777 [] def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
778 [] symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName,
780 [] describe_def: DescribeDef(DefId) -> Option<Def>,
781 [] def_span: DefSpan(DefId) -> Span,
782 [] stability: Stability(DefId) -> Option<attr::Stability>,
783 [] deprecation: Deprecation(DefId) -> Option<attr::Deprecation>,
784 [] item_body_nested_bodies: metadata_dep_node(DefId) -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
785 [] const_is_rvalue_promotable_to_static: metadata_dep_node(DefId) -> bool,
786 [] is_mir_available: metadata_dep_node(DefId) -> bool,
789 fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {
790 DepNode::CoherenceCheckTrait(def_id)
793 fn crate_inherent_impls_dep_node(_: CrateNum) -> DepNode<DefId> {
797 fn reachability_dep_node(_: CrateNum) -> DepNode<DefId> {
798 DepNode::Reachability
801 fn metadata_dep_node(def_id: DefId) -> DepNode<DefId> {
802 DepNode::MetaData(def_id)
805 fn mir_shim_dep_node(instance: ty::InstanceDef) -> DepNode<DefId> {
809 fn symbol_name_dep_node(instance: ty::Instance) -> DepNode<DefId> {
810 // symbol_name uses the substs only to traverse them to find the
811 // hash, and that does not create any new dep-nodes.
812 DepNode::SymbolName(instance.def.def_id())
815 fn typeck_item_bodies_dep_node(_: CrateNum) -> DepNode<DefId> {
816 DepNode::TypeckBodiesKrate
819 fn const_eval_dep_node((def_id, _): (DefId, &Substs)) -> DepNode<DefId> {
820 DepNode::ConstEval(def_id)
823 fn mir_keys(_: CrateNum) -> DepNode<DefId> {
827 fn crate_variances(_: CrateNum) -> DepNode<DefId> {
828 DepNode::CrateVariances