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};
16 use errors::{Diagnostic, 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, Cell};
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,
36 pub(super) diagnostics: Option<Box<QueryDiagnostics>>,
39 impl<T> QueryValue<T> {
40 pub(super) fn new(value: T,
41 dep_node_index: DepNodeIndex,
42 diagnostics: Vec<Diagnostic>)
46 index: dep_node_index,
47 diagnostics: if diagnostics.len() == 0 {
50 Some(Box::new(QueryDiagnostics {
52 emitted_diagnostics: Cell::new(true),
59 pub(super) struct QueryDiagnostics {
60 pub(super) diagnostics: Vec<Diagnostic>,
61 pub(super) emitted_diagnostics: Cell<bool>,
64 impl<M: QueryDescription> QueryMap<M> {
65 pub(super) fn new() -> QueryMap<M> {
73 pub(super) struct CycleError<'a, 'tcx: 'a> {
75 cycle: RefMut<'a, [(Span, Query<'tcx>)]>,
78 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
79 pub(super) fn report_cycle(self, CycleError { span, cycle }: CycleError)
80 -> DiagnosticBuilder<'a>
82 // Subtle: release the refcell lock before invoking `describe()`
83 // below by dropping `cycle`.
84 let stack = cycle.to_vec();
87 assert!(!stack.is_empty());
89 // Disable naming impls with types in this path, since that
90 // sometimes cycles itself, leading to extra cycle errors.
91 // (And cycle errors around impls tend to occur during the
92 // collect/coherence phases anyhow.)
93 item_path::with_forced_impl_filename_line(|| {
95 struct_span_err!(self.sess, span, E0391,
96 "unsupported cyclic reference between types/traits detected");
97 err.span_label(span, "cyclic reference");
99 err.span_note(stack[0].0, &format!("the cycle begins when {}...",
100 stack[0].1.describe(self)));
102 for &(span, ref query) in &stack[1..] {
103 err.span_note(span, &format!("...which then requires {}...",
104 query.describe(self)));
107 err.note(&format!("...which then again requires {}, completing the cycle.",
108 stack[0].1.describe(self)));
114 pub(super) fn cycle_check<F, R>(self, span: Span, query: Query<'gcx>, compute: F)
115 -> Result<R, CycleError<'a, 'gcx>>
116 where F: FnOnce() -> R
119 let mut stack = self.maps.query_stack.borrow_mut();
120 if let Some((i, _)) = stack.iter().enumerate().rev()
121 .find(|&(_, &(_, ref q))| *q == query) {
122 return Err(CycleError {
124 cycle: RefMut::map(stack, |stack| &mut stack[i..])
127 stack.push((span, query));
130 let result = compute();
132 self.maps.query_stack.borrow_mut().pop();
138 // If enabled, send a message to the profile-queries thread
139 macro_rules! profq_msg {
140 ($tcx:expr, $msg:expr) => {
141 if cfg!(debug_assertions) {
142 if $tcx.sess.profile_queries() {
149 // If enabled, format a key using its debug string, which can be
150 // expensive to compute (in terms of time).
151 macro_rules! profq_key {
152 ($tcx:expr, $key:expr) => {
153 if cfg!(debug_assertions) {
154 if $tcx.sess.profile_queries_and_keys() {
155 Some(format!("{:?}", $key))
161 macro_rules! define_maps {
164 [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
166 use dep_graph::DepNodeIndex;
167 use std::cell::RefCell;
171 input: ($(([$($modifiers)*] [$($attr)*] [$name]))*)
174 impl<$tcx> Maps<$tcx> {
175 pub fn new(providers: IndexVec<CrateNum, Providers<$tcx>>)
179 query_stack: RefCell::new(vec![]),
180 $($name: RefCell::new(QueryMap::new())),*
186 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
187 pub enum Query<$tcx> {
188 $($(#[$attr])* $name($K)),*
192 #[derive(Clone, Debug, PartialEq, Eq)]
194 $($name(Option<String>)),*
197 impl<$tcx> Query<$tcx> {
198 pub fn describe(&self, tcx: TyCtxt) -> String {
199 let (r, name) = match *self {
200 $(Query::$name(key) => {
201 (queries::$name::describe(tcx, key), stringify!($name))
204 if tcx.sess.verbose() {
205 format!("{} [{}]", r, name)
213 use std::marker::PhantomData;
215 $(#[allow(bad_style)]
216 pub struct $name<$tcx> {
217 data: PhantomData<&$tcx ()>
221 $(impl<$tcx> QueryConfig for queries::$name<$tcx> {
226 impl<'a, $tcx, 'lcx> queries::$name<$tcx> {
229 fn to_dep_node(tcx: TyCtxt<'a, $tcx, 'lcx>, key: &$K) -> DepNode {
230 use dep_graph::DepConstructor::*;
232 DepNode::new(tcx, $node(*key))
235 fn try_get_with(tcx: TyCtxt<'a, $tcx, 'lcx>,
238 -> Result<$V, CycleError<'a, $tcx>>
240 debug!("ty::queries::{}::try_get_with(key={:?}, span={:?})",
246 ProfileQueriesMsg::QueryBegin(
248 QueryMsg::$name(profq_key!(tcx, key))
252 if let Some(value) = tcx.maps.$name.borrow().map.get(&key) {
253 if let Some(ref d) = value.diagnostics {
254 if !d.emitted_diagnostics.get() {
255 d.emitted_diagnostics.set(true);
256 let handle = tcx.sess.diagnostic();
257 for diagnostic in d.diagnostics.iter() {
258 DiagnosticBuilder::new_diagnostic(handle, diagnostic.clone())
263 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
264 tcx.dep_graph.read_index(value.index);
265 return Ok((&value.value).clone());
268 // FIXME(eddyb) Get more valid Span's on queries.
269 // def_span guard is necessary to prevent a recursive loop,
270 // default_span calls def_span query internally.
271 if span == DUMMY_SP && stringify!($name) != "def_span" {
272 span = key.default_span(tcx)
275 // Fast path for when incr. comp. is off. `to_dep_node` is
276 // expensive for some DepKinds.
277 if !tcx.dep_graph.is_fully_enabled() {
278 let null_dep_node = DepNode::new_no_params(::dep_graph::DepKind::Null);
279 return Self::force(tcx, key, span, null_dep_node)
283 let dep_node = Self::to_dep_node(tcx, &key);
285 if dep_node.kind.is_anon() {
286 profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
288 let res = tcx.cycle_check(span, Query::$name(key), || {
289 tcx.sess.diagnostic().track_diagnostics(|| {
290 tcx.dep_graph.with_anon_task(dep_node.kind, || {
291 Self::compute_result(tcx.global_tcx(), key)
296 profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd);
297 let ((result, dep_node_index), diagnostics) = res;
299 tcx.dep_graph.read_index(dep_node_index);
300 let value = QueryValue::new(result, dep_node_index, diagnostics);
311 if !dep_node.kind.is_input() {
312 use dep_graph::DepNodeColor;
313 if let Some(DepNodeColor::Green(dep_node_index)) = tcx.dep_graph
314 .node_color(&dep_node) {
315 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
316 tcx.dep_graph.read_index(dep_node_index);
317 return Self::load_from_disk_and_cache_in_memory(tcx,
323 if let Some(dep_node_index) = tcx.dep_graph.try_mark_green(tcx, &dep_node) {
324 debug_assert!(tcx.dep_graph.is_green(dep_node_index));
325 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
326 tcx.dep_graph.read_index(dep_node_index);
327 return Self::load_from_disk_and_cache_in_memory(tcx,
334 match Self::force(tcx, key, span, dep_node) {
335 Ok((result, dep_node_index)) => {
336 tcx.dep_graph.read_index(dep_node_index);
343 fn compute_result(tcx: TyCtxt<'a, $tcx, 'lcx>, key: $K) -> $V {
344 let provider = tcx.maps.providers[key.map_crate()].$name;
345 provider(tcx.global_tcx(), key)
348 fn load_from_disk_and_cache_in_memory(tcx: TyCtxt<'a, $tcx, 'lcx>,
351 dep_node_index: DepNodeIndex)
352 -> Result<$V, CycleError<'a, $tcx>>
354 debug_assert!(tcx.dep_graph.is_green(dep_node_index));
356 // We don't do any caching yet, so recompute
357 let (result, diagnostics) = tcx.cycle_check(span, Query::$name(key), || {
358 tcx.sess.diagnostic().track_diagnostics(|| {
359 // The dep-graph for this computation is already in place
360 tcx.dep_graph.with_ignore(|| {
361 Self::compute_result(tcx, key)
366 let value = QueryValue::new(result, dep_node_index, diagnostics);
377 fn force(tcx: TyCtxt<'a, $tcx, 'lcx>,
381 -> Result<($V, DepNodeIndex), CycleError<'a, $tcx>> {
382 debug_assert!(tcx.dep_graph.node_color(&dep_node).is_none());
384 profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
385 let res = tcx.cycle_check(span, Query::$name(key), || {
386 tcx.sess.diagnostic().track_diagnostics(|| {
387 tcx.dep_graph.with_task(dep_node,
390 Self::compute_result)
393 profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd);
395 let ((result, dep_node_index), diagnostics) = res;
397 let value = QueryValue::new(result, dep_node_index, diagnostics);
411 pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
412 -> Result<$V, DiagnosticBuilder<'a>> {
413 match Self::try_get_with(tcx, span, key) {
415 Err(e) => Err(tcx.report_cycle(e)),
420 #[derive(Copy, Clone)]
421 pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
422 pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
426 impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> {
427 type Target = TyCtxt<'a, 'gcx, 'tcx>;
428 fn deref(&self) -> &Self::Target {
433 impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> {
434 /// Return a transparent wrapper for `TyCtxt` which uses
435 /// `span` as the location of queries performed through it.
436 pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> {
444 pub fn $name(self, key: $K) -> $V {
445 self.at(DUMMY_SP).$name(key)
449 impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
451 pub fn $name(self, key: $K) -> $V {
452 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|mut e| {
454 Value::from_cycle_error(self.global_tcx())
459 define_provider_struct! {
461 input: ($(([$($modifiers)*] [$name] [$K] [$V]))*),
465 impl<$tcx> Copy for Providers<$tcx> {}
466 impl<$tcx> Clone for Providers<$tcx> {
467 fn clone(&self) -> Self { *self }
472 macro_rules! define_map_struct {
475 input: $input:tt) => {
486 output: ($($output:tt)*)) => {
487 pub struct Maps<$tcx> {
488 providers: IndexVec<CrateNum, Providers<$tcx>>,
489 query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
494 // Field recognized and ready to shift into the output
496 ready: ([$($pub:tt)*] [$($attr:tt)*] [$name:ident]),
498 output: ($($output:tt)*)) => {
503 $(#[$attr])* $($pub)* $name: RefCell<QueryMap<queries::$name<$tcx>>>,)
507 // No modifiers left? This is a private item.
509 input: (([] $attrs:tt $name:tt) $($input:tt)*),
510 output: $output:tt) => {
513 ready: ([] $attrs $name),
519 // Skip other modifiers
521 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
522 output: $output:tt) => {
525 input: (([$($modifiers)*] $($fields)*) $($input)*),
531 macro_rules! define_provider_struct {
533 (tcx: $tcx:tt, input: $input:tt) => {
534 define_provider_struct! {
544 output: ($(([$name:ident] [$K:ty] [$R:ty]))*)) => {
545 pub struct Providers<$tcx> {
546 $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $R,)*
549 impl<$tcx> Default for Providers<$tcx> {
550 fn default() -> Self {
551 $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
552 bug!("tcx.maps.{}({:?}) unsupported by its crate",
553 stringify!($name), key);
555 Providers { $($name),* }
560 // Something ready to shift:
562 ready: ($name:tt $K:tt $V:tt),
564 output: ($($output:tt)*)) => {
565 define_provider_struct! {
568 output: ($($output)* ($name $K $V))
572 // Regular queries produce a `V` only.
574 input: (([] $name:tt $K:tt $V:tt) $($input:tt)*),
575 output: $output:tt) => {
576 define_provider_struct! {
578 ready: ($name $K $V),
586 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
587 output: $output:tt) => {
588 define_provider_struct! {
590 input: (([$($modifiers)*] $($fields)*) $($input)*),
596 pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
599 use ty::maps::keys::Key;
600 use hir::def_id::LOCAL_CRATE;
602 // We should never get into the situation of having to force this from the DepNode.
603 // Since we cannot reconstruct the query key, we would always end up having to evaluate
604 // the first caller of this query that *is* reconstructible. This might very well be
605 // compile_codegen_unit() in which case we'd lose all re-use.
606 debug_assert!(dep_node.kind != DepKind::CodegenUnit,
607 "calling force_from_dep_node() on DepKind::CodegenUnit");
609 if !dep_node.kind.can_reconstruct_query_key() {
613 macro_rules! def_id {
615 if let Some(def_id) = dep_node.extract_def_id(tcx) {
618 // return from the whole function
625 () => { (def_id!()).krate }
629 ($query:ident, $key:expr) => {
631 use $crate::util::common::{ProfileQueriesMsg, profq_msg};
633 // FIXME(eddyb) Get more valid Span's on queries.
634 // def_span guard is necessary to prevent a recursive loop,
635 // default_span calls def_span query internally.
636 let span = if stringify!($query) != "def_span" {
637 $key.default_span(tcx)
639 ::syntax_pos::DUMMY_SP
643 ProfileQueriesMsg::QueryBegin(
645 ::ty::maps::QueryMsg::$query(profq_key!(tcx, $key))
649 match ::ty::maps::queries::$query::force(tcx, $key, span, *dep_node) {
652 tcx.report_cycle(e).emit();
659 match dep_node.kind {
660 // These are inputs that are expected to be pre-allocated and that
661 // should therefore always be red or green already
662 DepKind::AllLocalTraitImpls |
664 DepKind::CrateMetadata |
668 // This are anonymous nodes
674 DepKind::TraitSelect |
677 // We don't have enough information to reconstruct the query key of
679 DepKind::InstanceSymbolName |
681 DepKind::BorrowCheckKrate |
682 DepKind::Specializes |
683 DepKind::ImplementationsOfTrait |
684 DepKind::TypeParamPredicates |
685 DepKind::CodegenUnit |
686 DepKind::CompileCodegenUnit |
688 // This one is just odd
690 DepKind::WorkProduct => {
691 bug!("force_from_dep_node() - Encountered {:?}", dep_node.kind)
694 // These is not a queries
695 DepKind::CoherenceCheckTrait |
696 DepKind::ItemVarianceConstraints => {
700 DepKind::RegionScopeTree => { force!(region_scope_tree, def_id!()); }
702 DepKind::Coherence => { force!(crate_inherent_impls, LOCAL_CRATE); }
703 DepKind::CoherenceInherentImplOverlapCheck => {
704 force!(crate_inherent_impls_overlap_check, LOCAL_CRATE)
706 DepKind::PrivacyAccessLevels => { force!(privacy_access_levels, LOCAL_CRATE); }
707 DepKind::MirConstQualif => { force!(mir_const_qualif, def_id!()); }
708 DepKind::MirConst => { force!(mir_const, def_id!()); }
709 DepKind::MirValidated => { force!(mir_validated, def_id!()); }
710 DepKind::MirOptimized => { force!(optimized_mir, def_id!()); }
712 DepKind::BorrowCheck => { force!(borrowck, def_id!()); }
713 DepKind::MirBorrowCheck => { force!(mir_borrowck, def_id!()); }
714 DepKind::UnsafetyViolations => { force!(unsafety_violations, def_id!()); }
715 DepKind::Reachability => { force!(reachable_set, LOCAL_CRATE); }
716 DepKind::MirKeys => { force!(mir_keys, LOCAL_CRATE); }
717 DepKind::CrateVariances => { force!(crate_variances, LOCAL_CRATE); }
718 DepKind::AssociatedItems => { force!(associated_item, def_id!()); }
719 DepKind::TypeOfItem => { force!(type_of, def_id!()); }
720 DepKind::GenericsOfItem => { force!(generics_of, def_id!()); }
721 DepKind::PredicatesOfItem => { force!(predicates_of, def_id!()); }
722 DepKind::SuperPredicatesOfItem => { force!(super_predicates_of, def_id!()); }
723 DepKind::TraitDefOfItem => { force!(trait_def, def_id!()); }
724 DepKind::AdtDefOfItem => { force!(adt_def, def_id!()); }
725 DepKind::IsDefaultImpl => { force!(is_default_impl, def_id!()); }
726 DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); }
727 DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); }
728 DepKind::ClosureKind => { force!(closure_kind, def_id!()); }
729 DepKind::FnSignature => { force!(fn_sig, def_id!()); }
730 DepKind::GenSignature => { force!(generator_sig, def_id!()); }
731 DepKind::CoerceUnsizedInfo => { force!(coerce_unsized_info, def_id!()); }
732 DepKind::ItemVariances => { force!(variances_of, def_id!()); }
733 DepKind::IsConstFn => { force!(is_const_fn, def_id!()); }
734 DepKind::IsForeignItem => { force!(is_foreign_item, def_id!()); }
735 DepKind::SizedConstraint => { force!(adt_sized_constraint, def_id!()); }
736 DepKind::DtorckConstraint => { force!(adt_dtorck_constraint, def_id!()); }
737 DepKind::AdtDestructor => { force!(adt_destructor, def_id!()); }
738 DepKind::AssociatedItemDefIds => { force!(associated_item_def_ids, def_id!()); }
739 DepKind::InherentImpls => { force!(inherent_impls, def_id!()); }
740 DepKind::TypeckBodiesKrate => { force!(typeck_item_bodies, LOCAL_CRATE); }
741 DepKind::TypeckTables => { force!(typeck_tables_of, def_id!()); }
742 DepKind::HasTypeckTables => { force!(has_typeck_tables, def_id!()); }
743 DepKind::SymbolName => { force!(def_symbol_name, def_id!()); }
744 DepKind::SpecializationGraph => { force!(specialization_graph_of, def_id!()); }
745 DepKind::ObjectSafety => { force!(is_object_safe, def_id!()); }
746 DepKind::TraitImpls => { force!(trait_impls_of, def_id!()); }
748 DepKind::ParamEnv => { force!(param_env, def_id!()); }
749 DepKind::DescribeDef => { force!(describe_def, def_id!()); }
750 DepKind::DefSpan => { force!(def_span, def_id!()); }
751 DepKind::LookupStability => { force!(lookup_stability, def_id!()); }
752 DepKind::LookupDeprecationEntry => {
753 force!(lookup_deprecation_entry, def_id!());
755 DepKind::ItemBodyNestedBodies => { force!(item_body_nested_bodies, def_id!()); }
756 DepKind::ConstIsRvaluePromotableToStatic => {
757 force!(const_is_rvalue_promotable_to_static, def_id!());
759 DepKind::ImplParent => { force!(impl_parent, def_id!()); }
760 DepKind::TraitOfItem => { force!(trait_of_item, def_id!()); }
761 DepKind::IsExportedSymbol => { force!(is_exported_symbol, def_id!()); }
762 DepKind::IsMirAvailable => { force!(is_mir_available, def_id!()); }
763 DepKind::ItemAttrs => { force!(item_attrs, def_id!()); }
764 DepKind::FnArgNames => { force!(fn_arg_names, def_id!()); }
765 DepKind::DylibDepFormats => { force!(dylib_dependency_formats, krate!()); }
766 DepKind::IsPanicRuntime => { force!(is_panic_runtime, krate!()); }
767 DepKind::IsCompilerBuiltins => { force!(is_compiler_builtins, krate!()); }
768 DepKind::HasGlobalAllocator => { force!(has_global_allocator, krate!()); }
769 DepKind::ExternCrate => { force!(extern_crate, def_id!()); }
770 DepKind::LintLevels => { force!(lint_levels, LOCAL_CRATE); }
771 DepKind::InScopeTraits => { force!(in_scope_traits_map, def_id!().index); }
772 DepKind::ModuleExports => { force!(module_exports, def_id!()); }
773 DepKind::IsSanitizerRuntime => { force!(is_sanitizer_runtime, krate!()); }
774 DepKind::IsProfilerRuntime => { force!(is_profiler_runtime, krate!()); }
775 DepKind::GetPanicStrategy => { force!(panic_strategy, krate!()); }
776 DepKind::IsNoBuiltins => { force!(is_no_builtins, krate!()); }
777 DepKind::ImplDefaultness => { force!(impl_defaultness, def_id!()); }
778 DepKind::ExportedSymbolIds => { force!(exported_symbol_ids, krate!()); }
779 DepKind::NativeLibraries => { force!(native_libraries, krate!()); }
780 DepKind::PluginRegistrarFn => { force!(plugin_registrar_fn, krate!()); }
781 DepKind::DeriveRegistrarFn => { force!(derive_registrar_fn, krate!()); }
782 DepKind::CrateDisambiguator => { force!(crate_disambiguator, krate!()); }
783 DepKind::CrateHash => { force!(crate_hash, krate!()); }
784 DepKind::OriginalCrateName => { force!(original_crate_name, krate!()); }
786 DepKind::AllTraitImplementations => {
787 force!(all_trait_implementations, krate!());
790 DepKind::IsDllimportForeignItem => {
791 force!(is_dllimport_foreign_item, def_id!());
793 DepKind::IsStaticallyIncludedForeignItem => {
794 force!(is_statically_included_foreign_item, def_id!());
796 DepKind::NativeLibraryKind => { force!(native_library_kind, def_id!()); }
797 DepKind::LinkArgs => { force!(link_args, LOCAL_CRATE); }
799 DepKind::NamedRegion => { force!(named_region_map, def_id!().index); }
800 DepKind::IsLateBound => { force!(is_late_bound_map, def_id!().index); }
801 DepKind::ObjectLifetimeDefaults => {
802 force!(object_lifetime_defaults_map, def_id!().index);
805 DepKind::Visibility => { force!(visibility, def_id!()); }
806 DepKind::DepKind => { force!(dep_kind, krate!()); }
807 DepKind::CrateName => { force!(crate_name, krate!()); }
808 DepKind::ItemChildren => { force!(item_children, def_id!()); }
809 DepKind::ExternModStmtCnum => { force!(extern_mod_stmt_cnum, def_id!()); }
810 DepKind::GetLangItems => { force!(get_lang_items, LOCAL_CRATE); }
811 DepKind::DefinedLangItems => { force!(defined_lang_items, krate!()); }
812 DepKind::MissingLangItems => { force!(missing_lang_items, krate!()); }
813 DepKind::ExternConstBody => { force!(extern_const_body, def_id!()); }
814 DepKind::VisibleParentMap => { force!(visible_parent_map, LOCAL_CRATE); }
815 DepKind::MissingExternCrateItem => {
816 force!(missing_extern_crate_item, krate!());
818 DepKind::UsedCrateSource => { force!(used_crate_source, krate!()); }
819 DepKind::PostorderCnums => { force!(postorder_cnums, LOCAL_CRATE); }
820 DepKind::HasCloneClosures => { force!(has_clone_closures, krate!()); }
821 DepKind::HasCopyClosures => { force!(has_copy_closures, krate!()); }
823 DepKind::Freevars => { force!(freevars, def_id!()); }
824 DepKind::MaybeUnusedTraitImport => {
825 force!(maybe_unused_trait_import, def_id!());
827 DepKind::MaybeUnusedExternCrates => { force!(maybe_unused_extern_crates, LOCAL_CRATE); }
828 DepKind::StabilityIndex => { force!(stability_index, LOCAL_CRATE); }
829 DepKind::AllCrateNums => { force!(all_crate_nums, LOCAL_CRATE); }
830 DepKind::ExportedSymbols => { force!(exported_symbols, krate!()); }
831 DepKind::CollectAndPartitionTranslationItems => {
832 force!(collect_and_partition_translation_items, LOCAL_CRATE);
834 DepKind::ExportName => { force!(export_name, def_id!()); }
835 DepKind::ContainsExternIndicator => {
836 force!(contains_extern_indicator, def_id!());
838 DepKind::IsTranslatedFunction => { force!(is_translated_function, def_id!()); }
839 DepKind::OutputFilenames => { force!(output_filenames, LOCAL_CRATE); }