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 debug!("ty::queries::{}::try_get_with(key={:?}) - running try_mark_green",
327 if let Some(dep_node_index) = tcx.dep_graph.try_mark_green(tcx, &dep_node) {
328 debug_assert!(tcx.dep_graph.is_green(dep_node_index));
329 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
330 tcx.dep_graph.read_index(dep_node_index);
331 return Self::load_from_disk_and_cache_in_memory(tcx,
338 match Self::force(tcx, key, span, dep_node) {
339 Ok((result, dep_node_index)) => {
340 tcx.dep_graph.read_index(dep_node_index);
347 fn compute_result(tcx: TyCtxt<'a, $tcx, 'lcx>, key: $K) -> $V {
348 let provider = tcx.maps.providers[key.map_crate()].$name;
349 provider(tcx.global_tcx(), key)
352 fn load_from_disk_and_cache_in_memory(tcx: TyCtxt<'a, $tcx, 'lcx>,
355 dep_node_index: DepNodeIndex)
356 -> Result<$V, CycleError<'a, $tcx>>
358 debug_assert!(tcx.dep_graph.is_green(dep_node_index));
360 // We don't do any caching yet, so recompute
361 let (result, diagnostics) = tcx.cycle_check(span, Query::$name(key), || {
362 tcx.sess.diagnostic().track_diagnostics(|| {
363 // The dep-graph for this computation is already in place
364 tcx.dep_graph.with_ignore(|| {
365 Self::compute_result(tcx, key)
370 if tcx.sess.opts.debugging_opts.query_dep_graph {
371 tcx.dep_graph.mark_loaded_from_cache(dep_node_index, true);
374 let value = QueryValue::new(result, dep_node_index, diagnostics);
385 fn force(tcx: TyCtxt<'a, $tcx, 'lcx>,
389 -> Result<($V, DepNodeIndex), CycleError<'a, $tcx>> {
390 debug_assert!(tcx.dep_graph.node_color(&dep_node).is_none());
392 profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
393 let res = tcx.cycle_check(span, Query::$name(key), || {
394 tcx.sess.diagnostic().track_diagnostics(|| {
395 tcx.dep_graph.with_task(dep_node,
398 Self::compute_result)
401 profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd);
403 let ((result, dep_node_index), diagnostics) = res;
405 if tcx.sess.opts.debugging_opts.query_dep_graph {
406 tcx.dep_graph.mark_loaded_from_cache(dep_node_index, false);
409 let value = QueryValue::new(result, dep_node_index, diagnostics);
421 pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
422 -> Result<$V, DiagnosticBuilder<'a>> {
423 match Self::try_get_with(tcx, span, key) {
425 Err(e) => Err(tcx.report_cycle(e)),
430 #[derive(Copy, Clone)]
431 pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
432 pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
436 impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> {
437 type Target = TyCtxt<'a, 'gcx, 'tcx>;
438 fn deref(&self) -> &Self::Target {
443 impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> {
444 /// Return a transparent wrapper for `TyCtxt` which uses
445 /// `span` as the location of queries performed through it.
446 pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> {
454 pub fn $name(self, key: $K) -> $V {
455 self.at(DUMMY_SP).$name(key)
459 impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
461 pub fn $name(self, key: $K) -> $V {
462 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|mut e| {
464 Value::from_cycle_error(self.global_tcx())
469 define_provider_struct! {
471 input: ($(([$($modifiers)*] [$name] [$K] [$V]))*),
475 impl<$tcx> Copy for Providers<$tcx> {}
476 impl<$tcx> Clone for Providers<$tcx> {
477 fn clone(&self) -> Self { *self }
482 macro_rules! define_map_struct {
485 input: $input:tt) => {
496 output: ($($output:tt)*)) => {
497 pub struct Maps<$tcx> {
498 providers: IndexVec<CrateNum, Providers<$tcx>>,
499 query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
504 // Field recognized and ready to shift into the output
506 ready: ([$($pub:tt)*] [$($attr:tt)*] [$name:ident]),
508 output: ($($output:tt)*)) => {
513 $(#[$attr])* $($pub)* $name: RefCell<QueryMap<queries::$name<$tcx>>>,)
517 // No modifiers left? This is a private item.
519 input: (([] $attrs:tt $name:tt) $($input:tt)*),
520 output: $output:tt) => {
523 ready: ([] $attrs $name),
529 // Skip other modifiers
531 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
532 output: $output:tt) => {
535 input: (([$($modifiers)*] $($fields)*) $($input)*),
541 macro_rules! define_provider_struct {
543 (tcx: $tcx:tt, input: $input:tt) => {
544 define_provider_struct! {
554 output: ($(([$name:ident] [$K:ty] [$R:ty]))*)) => {
555 pub struct Providers<$tcx> {
556 $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $R,)*
559 impl<$tcx> Default for Providers<$tcx> {
560 fn default() -> Self {
561 $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
562 bug!("tcx.maps.{}({:?}) unsupported by its crate",
563 stringify!($name), key);
565 Providers { $($name),* }
570 // Something ready to shift:
572 ready: ($name:tt $K:tt $V:tt),
574 output: ($($output:tt)*)) => {
575 define_provider_struct! {
578 output: ($($output)* ($name $K $V))
582 // Regular queries produce a `V` only.
584 input: (([] $name:tt $K:tt $V:tt) $($input:tt)*),
585 output: $output:tt) => {
586 define_provider_struct! {
588 ready: ($name $K $V),
596 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
597 output: $output:tt) => {
598 define_provider_struct! {
600 input: (([$($modifiers)*] $($fields)*) $($input)*),
606 pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
609 use ty::maps::keys::Key;
610 use hir::def_id::LOCAL_CRATE;
612 // We should never get into the situation of having to force this from the DepNode.
613 // Since we cannot reconstruct the query key, we would always end up having to evaluate
614 // the first caller of this query that *is* reconstructible. This might very well be
615 // compile_codegen_unit() in which case we'd lose all re-use.
616 debug_assert!(dep_node.kind != DepKind::CodegenUnit,
617 "calling force_from_dep_node() on DepKind::CodegenUnit");
619 if !dep_node.kind.can_reconstruct_query_key() {
623 macro_rules! def_id {
625 if let Some(def_id) = dep_node.extract_def_id(tcx) {
628 // return from the whole function
635 () => { (def_id!()).krate }
639 ($query:ident, $key:expr) => {
641 use $crate::util::common::{ProfileQueriesMsg, profq_msg};
643 // FIXME(eddyb) Get more valid Span's on queries.
644 // def_span guard is necessary to prevent a recursive loop,
645 // default_span calls def_span query internally.
646 let span = if stringify!($query) != "def_span" {
647 $key.default_span(tcx)
649 ::syntax_pos::DUMMY_SP
653 ProfileQueriesMsg::QueryBegin(
655 ::ty::maps::QueryMsg::$query(profq_key!(tcx, $key))
659 match ::ty::maps::queries::$query::force(tcx, $key, span, *dep_node) {
662 tcx.report_cycle(e).emit();
669 match dep_node.kind {
670 // These are inputs that are expected to be pre-allocated and that
671 // should therefore always be red or green already
672 DepKind::AllLocalTraitImpls |
674 DepKind::CrateMetadata |
678 // This are anonymous nodes
684 DepKind::TraitSelect |
687 // We don't have enough information to reconstruct the query key of
689 DepKind::InstanceSymbolName |
691 DepKind::BorrowCheckKrate |
692 DepKind::Specializes |
693 DepKind::ImplementationsOfTrait |
694 DepKind::TypeParamPredicates |
695 DepKind::CodegenUnit |
696 DepKind::CompileCodegenUnit |
698 // This one is just odd
700 DepKind::WorkProduct => {
701 bug!("force_from_dep_node() - Encountered {:?}", dep_node.kind)
704 // These is not a queries
705 DepKind::CoherenceCheckTrait |
706 DepKind::ItemVarianceConstraints => {
710 DepKind::RegionScopeTree => { force!(region_scope_tree, def_id!()); }
712 DepKind::Coherence => { force!(crate_inherent_impls, LOCAL_CRATE); }
713 DepKind::CoherenceInherentImplOverlapCheck => {
714 force!(crate_inherent_impls_overlap_check, LOCAL_CRATE)
716 DepKind::PrivacyAccessLevels => { force!(privacy_access_levels, LOCAL_CRATE); }
717 DepKind::MirConstQualif => { force!(mir_const_qualif, def_id!()); }
718 DepKind::MirConst => { force!(mir_const, def_id!()); }
719 DepKind::MirValidated => { force!(mir_validated, def_id!()); }
720 DepKind::MirOptimized => { force!(optimized_mir, def_id!()); }
722 DepKind::BorrowCheck => { force!(borrowck, def_id!()); }
723 DepKind::MirBorrowCheck => { force!(mir_borrowck, def_id!()); }
724 DepKind::UnsafetyViolations => { force!(unsafety_violations, def_id!()); }
725 DepKind::Reachability => { force!(reachable_set, LOCAL_CRATE); }
726 DepKind::MirKeys => { force!(mir_keys, LOCAL_CRATE); }
727 DepKind::CrateVariances => { force!(crate_variances, LOCAL_CRATE); }
728 DepKind::AssociatedItems => { force!(associated_item, def_id!()); }
729 DepKind::TypeOfItem => { force!(type_of, def_id!()); }
730 DepKind::GenericsOfItem => { force!(generics_of, def_id!()); }
731 DepKind::PredicatesOfItem => { force!(predicates_of, def_id!()); }
732 DepKind::SuperPredicatesOfItem => { force!(super_predicates_of, def_id!()); }
733 DepKind::TraitDefOfItem => { force!(trait_def, def_id!()); }
734 DepKind::AdtDefOfItem => { force!(adt_def, def_id!()); }
735 DepKind::IsDefaultImpl => { force!(is_default_impl, def_id!()); }
736 DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); }
737 DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); }
738 DepKind::ClosureKind => { force!(closure_kind, def_id!()); }
739 DepKind::FnSignature => { force!(fn_sig, def_id!()); }
740 DepKind::GenSignature => { force!(generator_sig, def_id!()); }
741 DepKind::CoerceUnsizedInfo => { force!(coerce_unsized_info, def_id!()); }
742 DepKind::ItemVariances => { force!(variances_of, def_id!()); }
743 DepKind::IsConstFn => { force!(is_const_fn, def_id!()); }
744 DepKind::IsForeignItem => { force!(is_foreign_item, def_id!()); }
745 DepKind::SizedConstraint => { force!(adt_sized_constraint, def_id!()); }
746 DepKind::DtorckConstraint => { force!(adt_dtorck_constraint, def_id!()); }
747 DepKind::AdtDestructor => { force!(adt_destructor, def_id!()); }
748 DepKind::AssociatedItemDefIds => { force!(associated_item_def_ids, def_id!()); }
749 DepKind::InherentImpls => { force!(inherent_impls, def_id!()); }
750 DepKind::TypeckBodiesKrate => { force!(typeck_item_bodies, LOCAL_CRATE); }
751 DepKind::TypeckTables => { force!(typeck_tables_of, def_id!()); }
752 DepKind::HasTypeckTables => { force!(has_typeck_tables, def_id!()); }
753 DepKind::SymbolName => { force!(def_symbol_name, def_id!()); }
754 DepKind::SpecializationGraph => { force!(specialization_graph_of, def_id!()); }
755 DepKind::ObjectSafety => { force!(is_object_safe, def_id!()); }
756 DepKind::TraitImpls => { force!(trait_impls_of, def_id!()); }
758 DepKind::ParamEnv => { force!(param_env, def_id!()); }
759 DepKind::DescribeDef => { force!(describe_def, def_id!()); }
760 DepKind::DefSpan => { force!(def_span, def_id!()); }
761 DepKind::LookupStability => { force!(lookup_stability, def_id!()); }
762 DepKind::LookupDeprecationEntry => {
763 force!(lookup_deprecation_entry, def_id!());
765 DepKind::ItemBodyNestedBodies => { force!(item_body_nested_bodies, def_id!()); }
766 DepKind::ConstIsRvaluePromotableToStatic => {
767 force!(const_is_rvalue_promotable_to_static, def_id!());
769 DepKind::ImplParent => { force!(impl_parent, def_id!()); }
770 DepKind::TraitOfItem => { force!(trait_of_item, def_id!()); }
771 DepKind::IsExportedSymbol => { force!(is_exported_symbol, def_id!()); }
772 DepKind::IsMirAvailable => { force!(is_mir_available, def_id!()); }
773 DepKind::ItemAttrs => { force!(item_attrs, def_id!()); }
774 DepKind::FnArgNames => { force!(fn_arg_names, def_id!()); }
775 DepKind::DylibDepFormats => { force!(dylib_dependency_formats, krate!()); }
776 DepKind::IsPanicRuntime => { force!(is_panic_runtime, krate!()); }
777 DepKind::IsCompilerBuiltins => { force!(is_compiler_builtins, krate!()); }
778 DepKind::HasGlobalAllocator => { force!(has_global_allocator, krate!()); }
779 DepKind::ExternCrate => { force!(extern_crate, def_id!()); }
780 DepKind::LintLevels => { force!(lint_levels, LOCAL_CRATE); }
781 DepKind::InScopeTraits => { force!(in_scope_traits_map, def_id!().index); }
782 DepKind::ModuleExports => { force!(module_exports, def_id!()); }
783 DepKind::IsSanitizerRuntime => { force!(is_sanitizer_runtime, krate!()); }
784 DepKind::IsProfilerRuntime => { force!(is_profiler_runtime, krate!()); }
785 DepKind::GetPanicStrategy => { force!(panic_strategy, krate!()); }
786 DepKind::IsNoBuiltins => { force!(is_no_builtins, krate!()); }
787 DepKind::ImplDefaultness => { force!(impl_defaultness, def_id!()); }
788 DepKind::ExportedSymbolIds => { force!(exported_symbol_ids, krate!()); }
789 DepKind::NativeLibraries => { force!(native_libraries, krate!()); }
790 DepKind::PluginRegistrarFn => { force!(plugin_registrar_fn, krate!()); }
791 DepKind::DeriveRegistrarFn => { force!(derive_registrar_fn, krate!()); }
792 DepKind::CrateDisambiguator => { force!(crate_disambiguator, krate!()); }
793 DepKind::CrateHash => { force!(crate_hash, krate!()); }
794 DepKind::OriginalCrateName => { force!(original_crate_name, krate!()); }
796 DepKind::AllTraitImplementations => {
797 force!(all_trait_implementations, krate!());
800 DepKind::IsDllimportForeignItem => {
801 force!(is_dllimport_foreign_item, def_id!());
803 DepKind::IsStaticallyIncludedForeignItem => {
804 force!(is_statically_included_foreign_item, def_id!());
806 DepKind::NativeLibraryKind => { force!(native_library_kind, def_id!()); }
807 DepKind::LinkArgs => { force!(link_args, LOCAL_CRATE); }
809 DepKind::NamedRegion => { force!(named_region_map, def_id!().index); }
810 DepKind::IsLateBound => { force!(is_late_bound_map, def_id!().index); }
811 DepKind::ObjectLifetimeDefaults => {
812 force!(object_lifetime_defaults_map, def_id!().index);
815 DepKind::Visibility => { force!(visibility, def_id!()); }
816 DepKind::DepKind => { force!(dep_kind, krate!()); }
817 DepKind::CrateName => { force!(crate_name, krate!()); }
818 DepKind::ItemChildren => { force!(item_children, def_id!()); }
819 DepKind::ExternModStmtCnum => { force!(extern_mod_stmt_cnum, def_id!()); }
820 DepKind::GetLangItems => { force!(get_lang_items, LOCAL_CRATE); }
821 DepKind::DefinedLangItems => { force!(defined_lang_items, krate!()); }
822 DepKind::MissingLangItems => { force!(missing_lang_items, krate!()); }
823 DepKind::ExternConstBody => { force!(extern_const_body, def_id!()); }
824 DepKind::VisibleParentMap => { force!(visible_parent_map, LOCAL_CRATE); }
825 DepKind::MissingExternCrateItem => {
826 force!(missing_extern_crate_item, krate!());
828 DepKind::UsedCrateSource => { force!(used_crate_source, krate!()); }
829 DepKind::PostorderCnums => { force!(postorder_cnums, LOCAL_CRATE); }
830 DepKind::HasCloneClosures => { force!(has_clone_closures, krate!()); }
831 DepKind::HasCopyClosures => { force!(has_copy_closures, krate!()); }
833 DepKind::Freevars => { force!(freevars, def_id!()); }
834 DepKind::MaybeUnusedTraitImport => {
835 force!(maybe_unused_trait_import, def_id!());
837 DepKind::MaybeUnusedExternCrates => { force!(maybe_unused_extern_crates, LOCAL_CRATE); }
838 DepKind::StabilityIndex => { force!(stability_index, LOCAL_CRATE); }
839 DepKind::AllCrateNums => { force!(all_crate_nums, LOCAL_CRATE); }
840 DepKind::ExportedSymbols => { force!(exported_symbols, krate!()); }
841 DepKind::CollectAndPartitionTranslationItems => {
842 force!(collect_and_partition_translation_items, LOCAL_CRATE);
844 DepKind::ExportName => { force!(export_name, def_id!()); }
845 DepKind::ContainsExternIndicator => {
846 force!(contains_extern_indicator, def_id!());
848 DepKind::IsTranslatedFunction => { force!(is_translated_function, def_id!()); }
849 DepKind::OutputFilenames => { force!(output_filenames, LOCAL_CRATE); }