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};
23 use ty::subst::Substs;
24 use util::nodemap::{DefIdSet, NodeSet};
26 use rustc_data_structures::indexed_vec::IndexVec;
27 use std::cell::{RefCell, RefMut};
29 use std::collections::BTreeMap;
32 use syntax_pos::{Span, DUMMY_SP};
33 use syntax::symbol::Symbol;
36 fn map_crate(&self) -> CrateNum;
37 fn default_span(&self, tcx: TyCtxt) -> Span;
40 impl<'tcx> Key for ty::InstanceDef<'tcx> {
41 fn map_crate(&self) -> CrateNum {
45 fn default_span(&self, tcx: TyCtxt) -> Span {
46 tcx.def_span(self.def_id())
50 impl<'tcx> Key for ty::Instance<'tcx> {
51 fn map_crate(&self) -> CrateNum {
55 fn default_span(&self, tcx: TyCtxt) -> Span {
56 tcx.def_span(self.def_id())
60 impl Key for CrateNum {
61 fn map_crate(&self) -> CrateNum {
64 fn default_span(&self, _: TyCtxt) -> Span {
70 fn map_crate(&self) -> CrateNum {
73 fn default_span(&self, tcx: TyCtxt) -> Span {
78 impl Key for (DefId, DefId) {
79 fn map_crate(&self) -> CrateNum {
82 fn default_span(&self, tcx: TyCtxt) -> Span {
83 self.1.default_span(tcx)
87 impl Key for (CrateNum, DefId) {
88 fn map_crate(&self) -> CrateNum {
91 fn default_span(&self, tcx: TyCtxt) -> Span {
92 self.1.default_span(tcx)
96 impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
97 fn map_crate(&self) -> CrateNum {
100 fn default_span(&self, tcx: TyCtxt) -> Span {
101 self.0.default_span(tcx)
105 impl Key for (MirSuite, DefId) {
106 fn map_crate(&self) -> CrateNum {
109 fn default_span(&self, tcx: TyCtxt) -> Span {
110 self.1.default_span(tcx)
114 impl Key for (MirSuite, MirPassIndex, DefId) {
115 fn map_crate(&self) -> CrateNum {
118 fn default_span(&self, tcx: TyCtxt) -> Span {
119 self.2.default_span(tcx)
123 trait Value<'tcx>: Sized {
124 fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self;
127 impl<'tcx, T> Value<'tcx> for T {
128 default fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> T {
129 tcx.sess.abort_if_errors();
130 bug!("Value::from_cycle_error called without errors");
134 impl<'tcx, T: Default> Value<'tcx> for T {
135 default fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> T {
140 impl<'tcx> Value<'tcx> for Ty<'tcx> {
141 fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> {
146 impl<'tcx> Value<'tcx> for ty::DtorckConstraint<'tcx> {
147 fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
152 impl<'tcx> Value<'tcx> for ty::SymbolName {
153 fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
154 ty::SymbolName { name: Symbol::intern("<error>").as_str() }
158 pub struct CycleError<'a, 'tcx: 'a> {
160 cycle: RefMut<'a, [(Span, Query<'tcx>)]>,
163 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
164 pub fn report_cycle(self, CycleError { span, cycle }: CycleError) {
165 // Subtle: release the refcell lock before invoking `describe()`
166 // below by dropping `cycle`.
167 let stack = cycle.to_vec();
170 assert!(!stack.is_empty());
172 // Disable naming impls with types in this path, since that
173 // sometimes cycles itself, leading to extra cycle errors.
174 // (And cycle errors around impls tend to occur during the
175 // collect/coherence phases anyhow.)
176 item_path::with_forced_impl_filename_line(|| {
178 struct_span_err!(self.sess, span, E0391,
179 "unsupported cyclic reference between types/traits detected");
180 err.span_label(span, &format!("cyclic reference"));
182 err.span_note(stack[0].0, &format!("the cycle begins when {}...",
183 stack[0].1.describe(self)));
185 for &(span, ref query) in &stack[1..] {
186 err.span_note(span, &format!("...which then requires {}...",
187 query.describe(self)));
190 err.note(&format!("...which then again requires {}, completing the cycle.",
191 stack[0].1.describe(self)));
197 fn cycle_check<F, R>(self, span: Span, query: Query<'gcx>, compute: F)
198 -> Result<R, CycleError<'a, 'gcx>>
199 where F: FnOnce() -> R
202 let mut stack = self.maps.query_stack.borrow_mut();
203 if let Some((i, _)) = stack.iter().enumerate().rev()
204 .find(|&(_, &(_, ref q))| *q == query) {
205 return Err(CycleError {
207 cycle: RefMut::map(stack, |stack| &mut stack[i..])
210 stack.push((span, query));
213 let result = compute();
215 self.maps.query_stack.borrow_mut().pop();
221 trait QueryDescription: DepTrackingMapConfig {
222 fn describe(tcx: TyCtxt, key: Self::Key) -> String;
225 impl<M: DepTrackingMapConfig<Key=DefId>> QueryDescription for M {
226 default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
227 format!("processing `{}`", tcx.item_path_str(def_id))
231 impl<'tcx> QueryDescription for queries::super_predicates_of<'tcx> {
232 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
233 format!("computing the supertraits of `{}`",
234 tcx.item_path_str(def_id))
238 impl<'tcx> QueryDescription for queries::type_param_predicates<'tcx> {
239 fn describe(tcx: TyCtxt, (_, def_id): (DefId, DefId)) -> String {
240 let id = tcx.hir.as_local_node_id(def_id).unwrap();
241 format!("computing the bounds for type parameter `{}`",
242 tcx.hir.ty_param_name(id))
246 impl<'tcx> QueryDescription for queries::coherent_trait<'tcx> {
247 fn describe(tcx: TyCtxt, (_, def_id): (CrateNum, DefId)) -> String {
248 format!("coherence checking all impls of trait `{}`",
249 tcx.item_path_str(def_id))
253 impl<'tcx> QueryDescription for queries::crate_inherent_impls<'tcx> {
254 fn describe(_: TyCtxt, k: CrateNum) -> String {
255 format!("all inherent impls defined in crate `{:?}`", k)
259 impl<'tcx> QueryDescription for queries::crate_inherent_impls_overlap_check<'tcx> {
260 fn describe(_: TyCtxt, _: CrateNum) -> String {
261 format!("check for overlap between inherent impls defined in this crate")
265 impl<'tcx> QueryDescription for queries::mir_shims<'tcx> {
266 fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
267 format!("generating MIR shim for `{}`",
268 tcx.item_path_str(def.def_id()))
272 impl<'tcx> QueryDescription for queries::privacy_access_levels<'tcx> {
273 fn describe(_: TyCtxt, _: CrateNum) -> String {
274 format!("privacy access levels")
278 impl<'tcx> QueryDescription for queries::typeck_item_bodies<'tcx> {
279 fn describe(_: TyCtxt, _: CrateNum) -> String {
280 format!("type-checking all item bodies")
284 impl<'tcx> QueryDescription for queries::reachable_set<'tcx> {
285 fn describe(_: TyCtxt, _: CrateNum) -> String {
286 format!("reachability")
290 impl<'tcx> QueryDescription for queries::const_eval<'tcx> {
291 fn describe(tcx: TyCtxt, (def_id, _): (DefId, &'tcx Substs<'tcx>)) -> String {
292 format!("const-evaluating `{}`", tcx.item_path_str(def_id))
296 impl<'tcx> QueryDescription for queries::mir_keys<'tcx> {
297 fn describe(_: TyCtxt, _: CrateNum) -> String {
298 format!("getting a list of all mir_keys")
302 impl<'tcx> QueryDescription for queries::symbol_name<'tcx> {
303 fn describe(_tcx: TyCtxt, instance: ty::Instance<'tcx>) -> String {
304 format!("computing the symbol for `{}`", instance)
308 impl<'tcx> QueryDescription for queries::describe_def<'tcx> {
309 fn describe(_: TyCtxt, _: DefId) -> String {
314 impl<'tcx> QueryDescription for queries::def_span<'tcx> {
315 fn describe(_: TyCtxt, _: DefId) -> String {
320 impl<'tcx> QueryDescription for queries::item_body_nested_bodies<'tcx> {
321 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
322 format!("nested item bodies of `{}`", tcx.item_path_str(def_id))
326 impl<'tcx> QueryDescription for queries::const_is_rvalue_promotable_to_static<'tcx> {
327 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
328 format!("const checking if rvalue is promotable to static `{}`",
329 tcx.item_path_str(def_id))
333 impl<'tcx> QueryDescription for queries::is_item_mir_available<'tcx> {
334 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
335 format!("checking if item is mir available: `{}`",
336 tcx.item_path_str(def_id))
340 impl<'tcx> QueryDescription for queries::mir_suite<'tcx> {
341 fn describe(_: TyCtxt, (suite, _): (MirSuite, DefId)) -> String {
342 format!("MIR passes #{}.*", suite.0)
346 impl<'tcx> QueryDescription for queries::mir_pass<'tcx> {
347 fn describe(_: TyCtxt, (pass_set, pass_num, _): (MirSuite, MirPassIndex, DefId)) -> String {
348 format!("MIR pass #{}.{}", pass_set.0, pass_num.0)
352 macro_rules! define_maps {
355 [$($pub:tt)*] $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
356 pub struct Maps<$tcx> {
357 providers: IndexVec<CrateNum, Providers<$tcx>>,
358 query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
359 $($(#[$attr])* $($pub)* $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>),*
362 impl<$tcx> Maps<$tcx> {
363 pub fn new(dep_graph: DepGraph,
364 providers: IndexVec<CrateNum, Providers<$tcx>>)
368 query_stack: RefCell::new(vec![]),
369 $($name: RefCell::new(DepTrackingMap::new(dep_graph.clone()))),*
375 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
376 pub enum Query<$tcx> {
377 $($(#[$attr])* $name($K)),*
380 impl<$tcx> Query<$tcx> {
381 pub fn describe(&self, tcx: TyCtxt) -> String {
383 $(Query::$name(key) => queries::$name::describe(tcx, key)),*
389 use std::marker::PhantomData;
391 $(#[allow(bad_style)]
392 pub struct $name<$tcx> {
393 data: PhantomData<&$tcx ()>
397 $(impl<$tcx> DepTrackingMapConfig for queries::$name<$tcx> {
402 fn to_dep_node(key: &$K) -> DepNode<DefId> {
403 use dep_graph::DepNode::*;
408 impl<'a, $tcx, 'lcx> queries::$name<$tcx> {
409 fn try_get_with<F, R>(tcx: TyCtxt<'a, $tcx, 'lcx>,
413 -> Result<R, CycleError<'a, $tcx>>
414 where F: FnOnce(&$V) -> R
416 debug!("ty::queries::{}::try_get_with(key={:?}, span={:?})",
421 if let Some(result) = tcx.maps.$name.borrow().get(&key) {
422 return Ok(f(result));
425 // FIXME(eddyb) Get more valid Span's on queries.
426 // def_span guard is necesary to prevent a recursive loop,
427 // default_span calls def_span query internally.
428 if span == DUMMY_SP && stringify!($name) != "def_span" {
429 span = key.default_span(tcx)
432 let _task = tcx.dep_graph.in_task(Self::to_dep_node(&key));
434 let result = tcx.cycle_check(span, Query::$name(key), || {
435 let provider = tcx.maps.providers[key.map_crate()].$name;
436 provider(tcx.global_tcx(), key)
439 Ok(f(&tcx.maps.$name.borrow_mut().entry(key).or_insert(result)))
442 pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
443 -> Result<$V, CycleError<'a, $tcx>> {
444 Self::try_get_with(tcx, span, key, Clone::clone)
447 pub fn force(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K) {
448 // FIXME(eddyb) Move away from using `DepTrackingMap`
449 // so we don't have to explicitly ignore a false edge:
450 // we can't observe a value dependency, only side-effects,
451 // through `force`, and once everything has been updated,
452 // perhaps only diagnostics, if those, will remain.
453 let _ignore = tcx.dep_graph.in_ignore();
454 match Self::try_get_with(tcx, span, key, |_| ()) {
456 Err(e) => tcx.report_cycle(e)
461 #[derive(Copy, Clone)]
462 pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
463 pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
467 impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> {
468 type Target = TyCtxt<'a, 'gcx, 'tcx>;
469 fn deref(&self) -> &Self::Target {
474 impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> {
475 /// Return a transparent wrapper for `TyCtxt` which uses
476 /// `span` as the location of queries performed through it.
477 pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> {
485 pub fn $name(self, key: $K) -> $V {
486 self.at(DUMMY_SP).$name(key)
490 impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
492 pub fn $name(self, key: $K) -> $V {
493 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|e| {
494 self.report_cycle(e);
495 Value::from_cycle_error(self.global_tcx())
500 pub struct Providers<$tcx> {
501 $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $V),*
504 impl<$tcx> Copy for Providers<$tcx> {}
505 impl<$tcx> Clone for Providers<$tcx> {
506 fn clone(&self) -> Self { *self }
509 impl<$tcx> Default for Providers<$tcx> {
510 fn default() -> Self {
511 $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $V {
512 bug!("tcx.maps.{}({:?}) unsupported by its crate",
513 stringify!($name), key);
515 Providers { $($name),* }
521 // Each of these maps also corresponds to a method on a
522 // `Provider` trait for requesting a value of that type,
523 // and a method on `Maps` itself for doing that in a
524 // a way that memoizes and does dep-graph tracking,
525 // wrapping around the actual chain of providers that
526 // the driver creates (using several `rustc_*` crates).
527 define_maps! { <'tcx>
528 /// Records the type of every item.
529 [] type_of: ItemSignature(DefId) -> Ty<'tcx>,
531 /// Maps from the def-id of an item (trait/struct/enum/fn) to its
532 /// associated generics and predicates.
533 [] generics_of: ItemSignature(DefId) -> &'tcx ty::Generics,
534 [] predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
536 /// Maps from the def-id of a trait to the list of
537 /// super-predicates. This is a subset of the full list of
538 /// predicates. We store these in a separate map because we must
539 /// evaluate them even during type conversion, often before the
540 /// full predicates are available (note that supertraits have
541 /// additional acyclicity requirements).
542 [] super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
544 /// To avoid cycles within the predicates of a single item we compute
545 /// per-type-parameter predicates for resolving `T::AssocTy`.
546 [] type_param_predicates: TypeParamPredicates((DefId, DefId))
547 -> ty::GenericPredicates<'tcx>,
549 [] trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
550 [] adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
551 [] adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
552 [] adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
553 [] adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
555 /// True if this is a foreign item (i.e., linked via `extern { ... }`).
556 [] is_foreign_item: IsForeignItem(DefId) -> bool,
558 /// Maps from def-id of a type or region parameter to its
559 /// (inferred) variance.
560 [pub] variances_of: ItemSignature(DefId) -> Rc<Vec<ty::Variance>>,
562 /// Maps from an impl/trait def-id to a list of the def-ids of its items
563 [] associated_item_def_ids: AssociatedItemDefIds(DefId) -> Rc<Vec<DefId>>,
565 /// Maps from a trait item to the trait item "descriptor"
566 [] associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
568 [] impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
569 [] impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
571 /// Maps a DefId of a type to a list of its inherent impls.
572 /// Contains implementations of methods that are inherent to a type.
573 /// Methods in these implementations don't need to be exported.
574 [] inherent_impls: InherentImpls(DefId) -> Rc<Vec<DefId>>,
576 /// Set of all the def-ids in this crate that have MIR associated with
577 /// them. This includes all the body owners, but also things like struct
579 [] mir_keys: mir_keys(CrateNum) -> Rc<DefIdSet>,
581 /// Maps DefId's that have an associated Mir to the result
582 /// of the MIR qualify_consts pass. The actual meaning of
583 /// the value isn't known except to the pass itself.
584 [] mir_const_qualif: Mir(DefId) -> u8,
586 /// Performs the initial MIR construction. You almost certainly do not
587 /// want to use this query, because its output is intended to be stolen
588 /// immediately by the MIR passes below. Consider `optimized_mir` instead.
589 [] mir_build: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>>,
591 /// Fetch the MIR for a given def-id after the given set of passes has ben
592 /// applied to it. This is mostly an "intermediate" query. Normally, you would
593 /// prefer to use `optimized_mir(def_id)`, which will fetch the MIR after all
594 /// optimizations and so forth.
595 [] mir_suite: mir_suite((MirSuite, DefId)) -> &'tcx RefCell<mir::Mir<'tcx>>,
597 /// Fetch the MIR for a given def-id after a given pass has been executed. This is
598 /// **only** intended to be used by the `mir_suite` provider -- if you are using it
599 /// manually, you're doing it wrong.
600 [] mir_pass: mir_pass((MirSuite, MirPassIndex, DefId)) -> &'tcx RefCell<mir::Mir<'tcx>>,
602 /// MIR after our optimization passes have run. This is MIR that is ready
603 /// for trans. This is also the only query that can fetch non-local MIR, at present.
604 [] optimized_mir: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>>,
606 /// Records the type of each closure. The def ID is the ID of the
607 /// expression defining the closure.
608 [] closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
610 /// Records the type of each closure. The def ID is the ID of the
611 /// expression defining the closure.
612 [] closure_type: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
614 /// Caches CoerceUnsized kinds for impls on custom types.
615 [] coerce_unsized_info: ItemSignature(DefId)
616 -> ty::adjustment::CoerceUnsizedInfo,
618 [] typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
620 [] typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
622 [] has_typeck_tables: TypeckTables(DefId) -> bool,
624 [] coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
626 [] borrowck: BorrowCheck(DefId) -> (),
628 /// Gets a complete map from all types to their inherent impls.
629 /// Not meant to be used directly outside of coherence.
630 /// (Defined only for LOCAL_CRATE)
631 [] crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
633 /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
634 /// Not meant to be used directly outside of coherence.
635 /// (Defined only for LOCAL_CRATE)
636 [] crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node(CrateNum) -> (),
638 /// Results of evaluating const items or constants embedded in
639 /// other items (such as enum variant explicit discriminants).
640 [] const_eval: const_eval_dep_node((DefId, &'tcx Substs<'tcx>))
641 -> const_val::EvalResult<'tcx>,
643 /// Performs the privacy check and computes "access levels".
644 [] privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Rc<AccessLevels>,
646 [] reachable_set: reachability_dep_node(CrateNum) -> Rc<NodeSet>,
648 /// Per-function `RegionMaps`. The `DefId` should be the owner-def-id for the fn body;
649 /// in the case of closures or "inline" expressions, this will be redirected to the enclosing
651 [] region_maps: RegionMaps(DefId) -> Rc<RegionMaps<'tcx>>,
653 [] mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx RefCell<mir::Mir<'tcx>>,
655 [] def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
656 [] symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName,
658 [] describe_def: DescribeDef(DefId) -> Option<Def>,
659 [] def_span: DefSpan(DefId) -> Span,
661 [] item_body_nested_bodies: metadata_dep_node(DefId) -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
662 [] const_is_rvalue_promotable_to_static: metadata_dep_node(DefId) -> bool,
663 [] is_item_mir_available: metadata_dep_node(DefId) -> bool,
666 fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {
667 DepNode::CoherenceCheckTrait(def_id)
670 fn crate_inherent_impls_dep_node(_: CrateNum) -> DepNode<DefId> {
674 fn reachability_dep_node(_: CrateNum) -> DepNode<DefId> {
675 DepNode::Reachability
678 fn metadata_dep_node(def_id: DefId) -> DepNode<DefId> {
679 DepNode::MetaData(def_id)
682 fn mir_shim_dep_node(instance: ty::InstanceDef) -> DepNode<DefId> {
686 fn symbol_name_dep_node(instance: ty::Instance) -> DepNode<DefId> {
687 // symbol_name uses the substs only to traverse them to find the
688 // hash, and that does not create any new dep-nodes.
689 DepNode::SymbolName(instance.def.def_id())
692 fn typeck_item_bodies_dep_node(_: CrateNum) -> DepNode<DefId> {
693 DepNode::TypeckBodiesKrate
696 fn const_eval_dep_node((def_id, _): (DefId, &Substs)) -> DepNode<DefId> {
697 DepNode::ConstEval(def_id)
700 fn mir_keys(_: CrateNum) -> DepNode<DefId> {
704 fn mir_suite((_suite, def_id): (MirSuite, DefId)) -> DepNode<DefId> {
708 fn mir_pass((_suite, _pass_num, def_id): (MirSuite, MirPassIndex, DefId)) -> DepNode<DefId> {