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 //! The implementation of the query system itself. Defines the macros
12 //! that generate the actual methods on tcx which find and execute the
13 //! provider, manage the caches, and so forth.
15 use dep_graph::{DepNodeIndex, DepNode, DepKind, DepNodeColor};
16 use errors::DiagnosticBuilder;
18 use ty::maps::Query; // NB: actually generated by the macros in this file
19 use ty::maps::config::QueryDescription;
22 use rustc_data_structures::fx::{FxHashMap};
23 use std::cell::RefMut;
24 use std::marker::PhantomData;
28 pub(super) struct QueryMap<D: QueryDescription> {
29 phantom: PhantomData<D>,
30 pub(super) map: FxHashMap<D::Key, QueryValue<D::Value>>,
33 pub(super) struct QueryValue<T> {
35 pub(super) index: DepNodeIndex,
38 impl<T> QueryValue<T> {
39 pub(super) fn new(value: T,
40 dep_node_index: DepNodeIndex)
44 index: dep_node_index,
49 impl<M: QueryDescription> QueryMap<M> {
50 pub(super) fn new() -> QueryMap<M> {
58 pub(super) struct CycleError<'a, 'tcx: 'a> {
60 cycle: RefMut<'a, [(Span, Query<'tcx>)]>,
63 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
64 pub(super) fn report_cycle(self, CycleError { span, cycle }: CycleError)
65 -> DiagnosticBuilder<'a>
67 // Subtle: release the refcell lock before invoking `describe()`
68 // below by dropping `cycle`.
69 let stack = cycle.to_vec();
72 assert!(!stack.is_empty());
74 // Disable naming impls with types in this path, since that
75 // sometimes cycles itself, leading to extra cycle errors.
76 // (And cycle errors around impls tend to occur during the
77 // collect/coherence phases anyhow.)
78 item_path::with_forced_impl_filename_line(|| {
80 struct_span_err!(self.sess, span, E0391,
81 "unsupported cyclic reference between types/traits detected");
82 err.span_label(span, "cyclic reference");
84 err.span_note(stack[0].0, &format!("the cycle begins when {}...",
85 stack[0].1.describe(self)));
87 for &(span, ref query) in &stack[1..] {
88 err.span_note(span, &format!("...which then requires {}...",
89 query.describe(self)));
92 err.note(&format!("...which then again requires {}, completing the cycle.",
93 stack[0].1.describe(self)));
99 pub(super) fn cycle_check<F, R>(self, span: Span, query: Query<'gcx>, compute: F)
100 -> Result<R, CycleError<'a, 'gcx>>
101 where F: FnOnce() -> R
104 let mut stack = self.maps.query_stack.borrow_mut();
105 if let Some((i, _)) = stack.iter().enumerate().rev()
106 .find(|&(_, &(_, ref q))| *q == query) {
107 return Err(CycleError {
109 cycle: RefMut::map(stack, |stack| &mut stack[i..])
112 stack.push((span, query));
115 let result = compute();
117 self.maps.query_stack.borrow_mut().pop();
122 /// Try to read a node index for the node dep_node.
123 /// A node will have an index, when it's already been marked green, or when we can mark it
124 /// green. This function will mark the current task as a reader of the specified node, when
125 /// the a node index can be found for that node.
126 pub(super) fn try_mark_green_and_read(self, dep_node: &DepNode) -> Option<DepNodeIndex> {
127 match self.dep_graph.node_color(dep_node) {
128 Some(DepNodeColor::Green(dep_node_index)) => {
129 self.dep_graph.read_index(dep_node_index);
132 Some(DepNodeColor::Red) => {
136 // try_mark_green (called below) will panic when full incremental
137 // compilation is disabled. If that's the case, we can't try to mark nodes
138 // as green anyway, so we can safely return None here.
139 if !self.dep_graph.is_fully_enabled() {
142 match self.dep_graph.try_mark_green(self, &dep_node) {
143 Some(dep_node_index) => {
144 debug_assert!(self.dep_graph.is_green(dep_node_index));
145 self.dep_graph.read_index(dep_node_index);
157 // If enabled, send a message to the profile-queries thread
158 macro_rules! profq_msg {
159 ($tcx:expr, $msg:expr) => {
160 if cfg!(debug_assertions) {
161 if $tcx.sess.profile_queries() {
168 // If enabled, format a key using its debug string, which can be
169 // expensive to compute (in terms of time).
170 macro_rules! profq_key {
171 ($tcx:expr, $key:expr) => {
172 if cfg!(debug_assertions) {
173 if $tcx.sess.profile_queries_and_keys() {
174 Some(format!("{:?}", $key))
180 macro_rules! define_maps {
183 [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
185 use dep_graph::DepNodeIndex;
186 use std::cell::RefCell;
190 input: ($(([$($modifiers)*] [$($attr)*] [$name]))*)
193 impl<$tcx> Maps<$tcx> {
194 pub fn new(providers: IndexVec<CrateNum, Providers<$tcx>>)
198 query_stack: RefCell::new(vec![]),
199 $($name: RefCell::new(QueryMap::new())),*
205 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
206 pub enum Query<$tcx> {
207 $($(#[$attr])* $name($K)),*
211 #[derive(Clone, Debug, PartialEq, Eq)]
213 $($name(Option<String>)),*
216 impl<$tcx> Query<$tcx> {
217 pub fn describe(&self, tcx: TyCtxt) -> String {
218 let (r, name) = match *self {
219 $(Query::$name(key) => {
220 (queries::$name::describe(tcx, key), stringify!($name))
223 if tcx.sess.verbose() {
224 format!("{} [{}]", r, name)
232 use std::marker::PhantomData;
234 $(#[allow(bad_style)]
235 pub struct $name<$tcx> {
236 data: PhantomData<&$tcx ()>
240 $(impl<$tcx> QueryConfig for queries::$name<$tcx> {
245 impl<'a, $tcx, 'lcx> queries::$name<$tcx> {
248 fn to_dep_node(tcx: TyCtxt<'a, $tcx, 'lcx>, key: &$K) -> DepNode {
249 use dep_graph::DepConstructor::*;
251 DepNode::new(tcx, $node(*key))
254 fn try_get_with(tcx: TyCtxt<'a, $tcx, 'lcx>,
257 -> Result<$V, CycleError<'a, $tcx>>
259 debug!("ty::queries::{}::try_get_with(key={:?}, span={:?})",
265 ProfileQueriesMsg::QueryBegin(
267 QueryMsg::$name(profq_key!(tcx, key))
271 if let Some(value) = tcx.maps.$name.borrow().map.get(&key) {
272 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
273 tcx.dep_graph.read_index(value.index);
274 return Ok((&value.value).clone());
277 // FIXME(eddyb) Get more valid Span's on queries.
278 // def_span guard is necessary to prevent a recursive loop,
279 // default_span calls def_span query internally.
280 if span == DUMMY_SP && stringify!($name) != "def_span" {
281 span = key.default_span(tcx)
284 // Fast path for when incr. comp. is off. `to_dep_node` is
285 // expensive for some DepKinds.
286 if !tcx.dep_graph.is_fully_enabled() {
287 let null_dep_node = DepNode::new_no_params(::dep_graph::DepKind::Null);
288 return Self::force(tcx, key, span, null_dep_node)
292 let dep_node = Self::to_dep_node(tcx, &key);
294 if dep_node.kind.is_anon() {
295 profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
297 let res = tcx.cycle_check(span, Query::$name(key), || {
298 tcx.sess.diagnostic().track_diagnostics(|| {
299 tcx.dep_graph.with_anon_task(dep_node.kind, || {
300 Self::compute_result(tcx.global_tcx(), key)
305 profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd);
306 let ((result, dep_node_index), diagnostics) = res;
308 tcx.dep_graph.read_index(dep_node_index);
310 tcx.on_disk_query_result_cache
311 .store_diagnostics_for_anon_node(dep_node_index, diagnostics);
313 let value = QueryValue::new(result, dep_node_index);
324 if !dep_node.kind.is_input() {
325 if let Some(dep_node_index) = tcx.try_mark_green_and_read(&dep_node) {
326 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
327 return Self::load_from_disk_and_cache_in_memory(tcx,
335 match Self::force(tcx, key, span, dep_node) {
336 Ok((result, dep_node_index)) => {
337 tcx.dep_graph.read_index(dep_node_index);
344 /// Ensure that either this query has all green inputs or been executed.
345 /// Executing query::ensure(D) is considered a read of the dep-node D.
347 /// This function is particularly useful when executing passes for their
348 /// side-effects -- e.g., in order to report errors for erroneous programs.
350 /// Note: The optimization is only available during incr. comp.
351 pub fn ensure(tcx: TyCtxt<'a, $tcx, 'lcx>, key: $K) -> () {
352 let dep_node = Self::to_dep_node(tcx, &key);
354 // Ensuring an "input" or anonymous query makes no sense
355 assert!(!dep_node.kind.is_anon());
356 assert!(!dep_node.kind.is_input());
357 if tcx.try_mark_green_and_read(&dep_node).is_none() {
358 // A None return from `try_mark_green_and_read` means that this is either
359 // a new dep node or that the dep node has already been marked red.
360 // Either way, we can't call `dep_graph.read()` as we don't have the
361 // DepNodeIndex. We must invoke the query itself. The performance cost
362 // this introduces should be negligible as we'll immediately hit the
363 // in-memory cache, or another query down the line will.
364 let _ = tcx.$name(key);
368 fn compute_result(tcx: TyCtxt<'a, $tcx, 'lcx>, key: $K) -> $V {
369 let provider = tcx.maps.providers[key.map_crate()].$name;
370 provider(tcx.global_tcx(), key)
373 fn load_from_disk_and_cache_in_memory(tcx: TyCtxt<'a, $tcx, 'lcx>,
376 dep_node_index: DepNodeIndex,
378 -> Result<$V, CycleError<'a, $tcx>>
380 debug_assert!(tcx.dep_graph.is_green(dep_node_index));
382 // We don't do any caching yet, so recompute.
383 // The diagnostics for this query have already been promoted to
384 // the current session during try_mark_green(), so we can ignore
386 let (result, _) = tcx.cycle_check(span, Query::$name(key), || {
387 tcx.sess.diagnostic().track_diagnostics(|| {
388 // The dep-graph for this computation is already in place
389 tcx.dep_graph.with_ignore(|| {
390 Self::compute_result(tcx, key)
395 // If -Zincremental-verify-ich is specified, re-hash results from
396 // the cache and make sure that they have the expected fingerprint.
397 if tcx.sess.opts.debugging_opts.incremental_verify_ich {
398 use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
399 use ich::Fingerprint;
401 assert!(Some(tcx.dep_graph.fingerprint_of(dep_node)) ==
402 tcx.dep_graph.prev_fingerprint_of(dep_node),
403 "Fingerprint for green query instance not loaded \
404 from cache: {:?}", dep_node);
406 debug!("BEGIN verify_ich({:?})", dep_node);
407 let mut hcx = tcx.create_stable_hashing_context();
408 let mut hasher = StableHasher::new();
410 result.hash_stable(&mut hcx, &mut hasher);
412 let new_hash: Fingerprint = hasher.finish();
413 debug!("END verify_ich({:?})", dep_node);
415 let old_hash = tcx.dep_graph.fingerprint_of(dep_node);
417 assert!(new_hash == old_hash, "Found unstable fingerprints \
418 for {:?}", dep_node);
421 if tcx.sess.opts.debugging_opts.query_dep_graph {
422 tcx.dep_graph.mark_loaded_from_cache(dep_node_index, true);
425 let value = QueryValue::new(result, dep_node_index);
436 fn force(tcx: TyCtxt<'a, $tcx, 'lcx>,
440 -> Result<($V, DepNodeIndex), CycleError<'a, $tcx>> {
441 debug_assert!(tcx.dep_graph.node_color(&dep_node).is_none());
443 profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
444 let res = tcx.cycle_check(span, Query::$name(key), || {
445 tcx.sess.diagnostic().track_diagnostics(|| {
446 if dep_node.kind.is_eval_always() {
447 tcx.dep_graph.with_eval_always_task(dep_node,
450 Self::compute_result)
452 tcx.dep_graph.with_task(dep_node,
455 Self::compute_result)
459 profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd);
461 let ((result, dep_node_index), diagnostics) = res;
463 if tcx.sess.opts.debugging_opts.query_dep_graph {
464 tcx.dep_graph.mark_loaded_from_cache(dep_node_index, false);
467 if dep_node.kind != ::dep_graph::DepKind::Null {
468 tcx.on_disk_query_result_cache
469 .store_diagnostics(dep_node_index, diagnostics);
472 let value = QueryValue::new(result, dep_node_index);
484 pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
485 -> Result<$V, DiagnosticBuilder<'a>> {
486 match Self::try_get_with(tcx, span, key) {
488 Err(e) => Err(tcx.report_cycle(e)),
493 #[derive(Copy, Clone)]
494 pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
495 pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
499 impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> {
500 type Target = TyCtxt<'a, 'gcx, 'tcx>;
501 fn deref(&self) -> &Self::Target {
506 impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> {
507 /// Return a transparent wrapper for `TyCtxt` which uses
508 /// `span` as the location of queries performed through it.
509 pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> {
517 pub fn $name(self, key: $K) -> $V {
518 self.at(DUMMY_SP).$name(key)
522 impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
524 pub fn $name(self, key: $K) -> $V {
525 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|mut e| {
527 Value::from_cycle_error(self.global_tcx())
532 define_provider_struct! {
534 input: ($(([$($modifiers)*] [$name] [$K] [$V]))*)
537 impl<$tcx> Copy for Providers<$tcx> {}
538 impl<$tcx> Clone for Providers<$tcx> {
539 fn clone(&self) -> Self { *self }
544 macro_rules! define_map_struct {
546 input: ($(([$(modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
547 pub struct Maps<$tcx> {
548 providers: IndexVec<CrateNum, Providers<$tcx>>,
549 query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
550 $($(#[$attr])* $name: RefCell<QueryMap<queries::$name<$tcx>>>,)*
555 macro_rules! define_provider_struct {
557 input: ($(([$($modifiers:tt)*] [$name:ident] [$K:ty] [$R:ty]))*)) => {
558 pub struct Providers<$tcx> {
559 $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $R,)*
562 impl<$tcx> Default for Providers<$tcx> {
563 fn default() -> Self {
564 $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
565 bug!("tcx.maps.{}({:?}) unsupported by its crate",
566 stringify!($name), key);
568 Providers { $($name),* }
575 /// The red/green evaluation system will try to mark a specific DepNode in the
576 /// dependency graph as green by recursively trying to mark the dependencies of
577 /// that DepNode as green. While doing so, it will sometimes encounter a DepNode
578 /// where we don't know if it is red or green and we therefore actually have
579 /// to recompute its value in order to find out. Since the only piece of
580 /// information that we have at that point is the DepNode we are trying to
581 /// re-evaluate, we need some way to re-run a query from just that. This is what
582 /// `force_from_dep_node()` implements.
584 /// In the general case, a DepNode consists of a DepKind and an opaque
585 /// GUID/fingerprint that will uniquely identify the node. This GUID/fingerprint
586 /// is usually constructed by computing a stable hash of the query-key that the
587 /// DepNode corresponds to. Consequently, it is not in general possible to go
588 /// back from hash to query-key (since hash functions are not reversible). For
589 /// this reason `force_from_dep_node()` is expected to fail from time to time
590 /// because we just cannot find out, from the DepNode alone, what the
591 /// corresponding query-key is and therefore cannot re-run the query.
593 /// The system deals with this case letting `try_mark_green` fail which forces
594 /// the root query to be re-evaluated.
596 /// Now, if force_from_dep_node() would always fail, it would be pretty useless.
597 /// Fortunately, we can use some contextual information that will allow us to
598 /// reconstruct query-keys for certain kinds of DepNodes. In particular, we
599 /// enforce by construction that the GUID/fingerprint of certain DepNodes is a
600 /// valid DefPathHash. Since we also always build a huge table that maps every
601 /// DefPathHash in the current codebase to the corresponding DefId, we have
602 /// everything we need to re-run the query.
604 /// Take the `mir_validated` query as an example. Like many other queries, it
605 /// just has a single parameter: the DefId of the item it will compute the
606 /// validated MIR for. Now, when we call `force_from_dep_node()` on a dep-node
607 /// with kind `MirValidated`, we know that the GUID/fingerprint of the dep-node
608 /// is actually a DefPathHash, and can therefore just look up the corresponding
609 /// DefId in `tcx.def_path_hash_to_def_id`.
611 /// When you implement a new query, it will likely have a corresponding new
612 /// DepKind, and you'll have to support it here in `force_from_dep_node()`. As
613 /// a rule of thumb, if your query takes a DefId or DefIndex as sole parameter,
614 /// then `force_from_dep_node()` should not fail for it. Otherwise, you can just
615 /// add it to the "We don't have enough information to reconstruct..." group in
617 pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
620 use ty::maps::keys::Key;
621 use hir::def_id::LOCAL_CRATE;
623 // We must avoid ever having to call force_from_dep_node() for a
624 // DepNode::CodegenUnit:
625 // Since we cannot reconstruct the query key of a DepNode::CodegenUnit, we
626 // would always end up having to evaluate the first caller of the
627 // `codegen_unit` query that *is* reconstructible. This might very well be
628 // the `compile_codegen_unit` query, thus re-translating the whole CGU just
629 // to re-trigger calling the `codegen_unit` query with the right key. At
630 // that point we would already have re-done all the work we are trying to
631 // avoid doing in the first place.
632 // The solution is simple: Just explicitly call the `codegen_unit` query for
633 // each CGU, right after partitioning. This way `try_mark_green` will always
634 // hit the cache instead of having to go through `force_from_dep_node`.
635 // This assertion makes sure, we actually keep applying the solution above.
636 debug_assert!(dep_node.kind != DepKind::CodegenUnit,
637 "calling force_from_dep_node() on DepKind::CodegenUnit");
639 if !dep_node.kind.can_reconstruct_query_key() {
643 macro_rules! def_id {
645 if let Some(def_id) = dep_node.extract_def_id(tcx) {
648 // return from the whole function
655 () => { (def_id!()).krate }
659 ($query:ident, $key:expr) => {
661 use $crate::util::common::{ProfileQueriesMsg, profq_msg};
663 // FIXME(eddyb) Get more valid Span's on queries.
664 // def_span guard is necessary to prevent a recursive loop,
665 // default_span calls def_span query internally.
666 let span = if stringify!($query) != "def_span" {
667 $key.default_span(tcx)
669 ::syntax_pos::DUMMY_SP
673 ProfileQueriesMsg::QueryBegin(
675 ::ty::maps::QueryMsg::$query(profq_key!(tcx, $key))
679 match ::ty::maps::queries::$query::force(tcx, $key, span, *dep_node) {
682 tcx.report_cycle(e).emit();
689 // FIXME(#45015): We should try move this boilerplate code into a macro
691 match dep_node.kind {
692 // These are inputs that are expected to be pre-allocated and that
693 // should therefore always be red or green already
694 DepKind::AllLocalTraitImpls |
696 DepKind::CrateMetadata |
700 // This are anonymous nodes
701 DepKind::TraitSelect |
703 // We don't have enough information to reconstruct the query key of
711 DepKind::InstanceSymbolName |
713 DepKind::BorrowCheckKrate |
714 DepKind::Specializes |
715 DepKind::ImplementationsOfTrait |
716 DepKind::TypeParamPredicates |
717 DepKind::CodegenUnit |
718 DepKind::CompileCodegenUnit |
719 DepKind::FulfillObligation |
720 DepKind::VtableMethods |
721 DepKind::EraseRegionsTy |
722 DepKind::NormalizeTy |
724 // This one should never occur in this context
726 bug!("force_from_dep_node() - Encountered {:?}", dep_node.kind)
729 // These are not queries
730 DepKind::CoherenceCheckTrait |
731 DepKind::ItemVarianceConstraints => {
735 DepKind::RegionScopeTree => { force!(region_scope_tree, def_id!()); }
737 DepKind::Coherence => { force!(crate_inherent_impls, LOCAL_CRATE); }
738 DepKind::CoherenceInherentImplOverlapCheck => {
739 force!(crate_inherent_impls_overlap_check, LOCAL_CRATE)
741 DepKind::PrivacyAccessLevels => { force!(privacy_access_levels, LOCAL_CRATE); }
742 DepKind::MirBuilt => { force!(mir_built, def_id!()); }
743 DepKind::MirConstQualif => { force!(mir_const_qualif, def_id!()); }
744 DepKind::MirConst => { force!(mir_const, def_id!()); }
745 DepKind::MirValidated => { force!(mir_validated, def_id!()); }
746 DepKind::MirOptimized => { force!(optimized_mir, def_id!()); }
748 DepKind::BorrowCheck => { force!(borrowck, def_id!()); }
749 DepKind::MirBorrowCheck => { force!(mir_borrowck, def_id!()); }
750 DepKind::UnsafetyCheckResult => { force!(unsafety_check_result, def_id!()); }
751 DepKind::Reachability => { force!(reachable_set, LOCAL_CRATE); }
752 DepKind::MirKeys => { force!(mir_keys, LOCAL_CRATE); }
753 DepKind::CrateVariances => { force!(crate_variances, LOCAL_CRATE); }
754 DepKind::AssociatedItems => { force!(associated_item, def_id!()); }
755 DepKind::TypeOfItem => { force!(type_of, def_id!()); }
756 DepKind::GenericsOfItem => { force!(generics_of, def_id!()); }
757 DepKind::PredicatesOfItem => { force!(predicates_of, def_id!()); }
758 DepKind::InferredOutlivesOf => { force!(inferred_outlives_of, def_id!()); }
759 DepKind::SuperPredicatesOfItem => { force!(super_predicates_of, def_id!()); }
760 DepKind::TraitDefOfItem => { force!(trait_def, def_id!()); }
761 DepKind::AdtDefOfItem => { force!(adt_def, def_id!()); }
762 DepKind::IsAutoImpl => { force!(is_auto_impl, def_id!()); }
763 DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); }
764 DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); }
765 DepKind::ClosureKind => { force!(closure_kind, def_id!()); }
766 DepKind::FnSignature => { force!(fn_sig, def_id!()); }
767 DepKind::GenSignature => { force!(generator_sig, def_id!()); }
768 DepKind::CoerceUnsizedInfo => { force!(coerce_unsized_info, def_id!()); }
769 DepKind::ItemVariances => { force!(variances_of, def_id!()); }
770 DepKind::IsConstFn => { force!(is_const_fn, def_id!()); }
771 DepKind::IsForeignItem => { force!(is_foreign_item, def_id!()); }
772 DepKind::SizedConstraint => { force!(adt_sized_constraint, def_id!()); }
773 DepKind::DtorckConstraint => { force!(adt_dtorck_constraint, def_id!()); }
774 DepKind::AdtDestructor => { force!(adt_destructor, def_id!()); }
775 DepKind::AssociatedItemDefIds => { force!(associated_item_def_ids, def_id!()); }
776 DepKind::InherentImpls => { force!(inherent_impls, def_id!()); }
777 DepKind::TypeckBodiesKrate => { force!(typeck_item_bodies, LOCAL_CRATE); }
778 DepKind::TypeckTables => { force!(typeck_tables_of, def_id!()); }
779 DepKind::UsedTraitImports => { force!(used_trait_imports, def_id!()); }
780 DepKind::HasTypeckTables => { force!(has_typeck_tables, def_id!()); }
781 DepKind::SymbolName => { force!(def_symbol_name, def_id!()); }
782 DepKind::SpecializationGraph => { force!(specialization_graph_of, def_id!()); }
783 DepKind::ObjectSafety => { force!(is_object_safe, def_id!()); }
784 DepKind::TraitImpls => { force!(trait_impls_of, def_id!()); }
786 DepKind::ParamEnv => { force!(param_env, def_id!()); }
787 DepKind::DescribeDef => { force!(describe_def, def_id!()); }
788 DepKind::DefSpan => { force!(def_span, def_id!()); }
789 DepKind::LookupStability => { force!(lookup_stability, def_id!()); }
790 DepKind::LookupDeprecationEntry => {
791 force!(lookup_deprecation_entry, def_id!());
793 DepKind::ItemBodyNestedBodies => { force!(item_body_nested_bodies, def_id!()); }
794 DepKind::ConstIsRvaluePromotableToStatic => {
795 force!(const_is_rvalue_promotable_to_static, def_id!());
797 DepKind::RvaluePromotableMap => { force!(rvalue_promotable_map, def_id!()); }
798 DepKind::ImplParent => { force!(impl_parent, def_id!()); }
799 DepKind::TraitOfItem => { force!(trait_of_item, def_id!()); }
800 DepKind::IsExportedSymbol => { force!(is_exported_symbol, def_id!()); }
801 DepKind::IsMirAvailable => { force!(is_mir_available, def_id!()); }
802 DepKind::ItemAttrs => { force!(item_attrs, def_id!()); }
803 DepKind::FnArgNames => { force!(fn_arg_names, def_id!()); }
804 DepKind::DylibDepFormats => { force!(dylib_dependency_formats, krate!()); }
805 DepKind::IsPanicRuntime => { force!(is_panic_runtime, krate!()); }
806 DepKind::IsCompilerBuiltins => { force!(is_compiler_builtins, krate!()); }
807 DepKind::HasGlobalAllocator => { force!(has_global_allocator, krate!()); }
808 DepKind::ExternCrate => { force!(extern_crate, def_id!()); }
809 DepKind::LintLevels => { force!(lint_levels, LOCAL_CRATE); }
810 DepKind::InScopeTraits => { force!(in_scope_traits_map, def_id!().index); }
811 DepKind::ModuleExports => { force!(module_exports, def_id!()); }
812 DepKind::IsSanitizerRuntime => { force!(is_sanitizer_runtime, krate!()); }
813 DepKind::IsProfilerRuntime => { force!(is_profiler_runtime, krate!()); }
814 DepKind::GetPanicStrategy => { force!(panic_strategy, krate!()); }
815 DepKind::IsNoBuiltins => { force!(is_no_builtins, krate!()); }
816 DepKind::ImplDefaultness => { force!(impl_defaultness, def_id!()); }
817 DepKind::ExportedSymbolIds => { force!(exported_symbol_ids, krate!()); }
818 DepKind::NativeLibraries => { force!(native_libraries, krate!()); }
819 DepKind::PluginRegistrarFn => { force!(plugin_registrar_fn, krate!()); }
820 DepKind::DeriveRegistrarFn => { force!(derive_registrar_fn, krate!()); }
821 DepKind::CrateDisambiguator => { force!(crate_disambiguator, krate!()); }
822 DepKind::CrateHash => { force!(crate_hash, krate!()); }
823 DepKind::OriginalCrateName => { force!(original_crate_name, krate!()); }
825 DepKind::AllTraitImplementations => {
826 force!(all_trait_implementations, krate!());
829 DepKind::IsDllimportForeignItem => {
830 force!(is_dllimport_foreign_item, def_id!());
832 DepKind::IsStaticallyIncludedForeignItem => {
833 force!(is_statically_included_foreign_item, def_id!());
835 DepKind::NativeLibraryKind => { force!(native_library_kind, def_id!()); }
836 DepKind::LinkArgs => { force!(link_args, LOCAL_CRATE); }
838 DepKind::NamedRegion => { force!(named_region_map, def_id!().index); }
839 DepKind::IsLateBound => { force!(is_late_bound_map, def_id!().index); }
840 DepKind::ObjectLifetimeDefaults => {
841 force!(object_lifetime_defaults_map, def_id!().index);
844 DepKind::Visibility => { force!(visibility, def_id!()); }
845 DepKind::DepKind => { force!(dep_kind, krate!()); }
846 DepKind::CrateName => { force!(crate_name, krate!()); }
847 DepKind::ItemChildren => { force!(item_children, def_id!()); }
848 DepKind::ExternModStmtCnum => { force!(extern_mod_stmt_cnum, def_id!()); }
849 DepKind::GetLangItems => { force!(get_lang_items, LOCAL_CRATE); }
850 DepKind::DefinedLangItems => { force!(defined_lang_items, krate!()); }
851 DepKind::MissingLangItems => { force!(missing_lang_items, krate!()); }
852 DepKind::ExternConstBody => { force!(extern_const_body, def_id!()); }
853 DepKind::VisibleParentMap => { force!(visible_parent_map, LOCAL_CRATE); }
854 DepKind::MissingExternCrateItem => {
855 force!(missing_extern_crate_item, krate!());
857 DepKind::UsedCrateSource => { force!(used_crate_source, krate!()); }
858 DepKind::PostorderCnums => { force!(postorder_cnums, LOCAL_CRATE); }
859 DepKind::HasCloneClosures => { force!(has_clone_closures, krate!()); }
860 DepKind::HasCopyClosures => { force!(has_copy_closures, krate!()); }
862 DepKind::Freevars => { force!(freevars, def_id!()); }
863 DepKind::MaybeUnusedTraitImport => {
864 force!(maybe_unused_trait_import, def_id!());
866 DepKind::MaybeUnusedExternCrates => { force!(maybe_unused_extern_crates, LOCAL_CRATE); }
867 DepKind::StabilityIndex => { force!(stability_index, LOCAL_CRATE); }
868 DepKind::AllCrateNums => { force!(all_crate_nums, LOCAL_CRATE); }
869 DepKind::ExportedSymbols => { force!(exported_symbols, krate!()); }
870 DepKind::CollectAndPartitionTranslationItems => {
871 force!(collect_and_partition_translation_items, LOCAL_CRATE);
873 DepKind::ExportName => { force!(export_name, def_id!()); }
874 DepKind::ContainsExternIndicator => {
875 force!(contains_extern_indicator, def_id!());
877 DepKind::IsTranslatedFunction => { force!(is_translated_function, def_id!()); }
878 DepKind::OutputFilenames => { force!(output_filenames, LOCAL_CRATE); }