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::{DepConstructor, DepNode, DepNodeIndex};
12 use errors::{Diagnostic, DiagnosticBuilder};
13 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE, DefIndex};
14 use hir::def::{Def, Export};
15 use hir::{self, TraitCandidate, ItemLocalId};
18 use middle::const_val;
19 use middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary};
20 use middle::cstore::{NativeLibraryKind, DepKind, CrateSource};
21 use middle::privacy::AccessLevels;
23 use middle::resolve_lifetime::{Region, ObjectLifetimeDefault};
24 use middle::stability::{self, DeprecationEntry};
25 use middle::lang_items::{LanguageItems, LangItem};
27 use mir::transform::{MirSuite, MirPassIndex};
28 use session::CompileResult;
29 use traits::specialization_graph;
30 use ty::{self, CrateInherentImpls, Ty, TyCtxt};
31 use ty::layout::{Layout, LayoutError};
34 use ty::subst::Substs;
35 use ty::fast_reject::SimplifiedType;
36 use util::nodemap::{DefIdSet, NodeSet, DefIdMap};
37 use util::common::{profq_msg, ProfileQueriesMsg};
39 use rustc_data_structures::indexed_set::IdxSetBuf;
40 use rustc_back::PanicStrategy;
41 use rustc_data_structures::indexed_vec::IndexVec;
42 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
43 use std::cell::{RefCell, RefMut, Cell};
46 use std::marker::PhantomData;
48 use std::collections::BTreeMap;
51 use syntax_pos::{Span, DUMMY_SP};
54 use syntax::symbol::Symbol;
56 pub trait Key: Clone + Hash + Eq + Debug {
57 fn map_crate(&self) -> CrateNum;
58 fn default_span(&self, tcx: TyCtxt) -> Span;
61 impl<'tcx> Key for ty::InstanceDef<'tcx> {
62 fn map_crate(&self) -> CrateNum {
66 fn default_span(&self, tcx: TyCtxt) -> Span {
67 tcx.def_span(self.def_id())
71 impl<'tcx> Key for ty::Instance<'tcx> {
72 fn map_crate(&self) -> CrateNum {
76 fn default_span(&self, tcx: TyCtxt) -> Span {
77 tcx.def_span(self.def_id())
81 impl Key for CrateNum {
82 fn map_crate(&self) -> CrateNum {
85 fn default_span(&self, _: TyCtxt) -> Span {
90 impl Key for DefIndex {
91 fn map_crate(&self) -> CrateNum {
94 fn default_span(&self, _tcx: TyCtxt) -> Span {
100 fn map_crate(&self) -> CrateNum {
103 fn default_span(&self, tcx: TyCtxt) -> Span {
108 impl Key for (DefId, DefId) {
109 fn map_crate(&self) -> CrateNum {
112 fn default_span(&self, tcx: TyCtxt) -> Span {
113 self.1.default_span(tcx)
117 impl Key for (CrateNum, DefId) {
118 fn map_crate(&self) -> CrateNum {
121 fn default_span(&self, tcx: TyCtxt) -> Span {
122 self.1.default_span(tcx)
126 impl Key for (DefId, SimplifiedType) {
127 fn map_crate(&self) -> CrateNum {
130 fn default_span(&self, tcx: TyCtxt) -> Span {
131 self.0.default_span(tcx)
135 impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) {
136 fn map_crate(&self) -> CrateNum {
139 fn default_span(&self, tcx: TyCtxt) -> Span {
140 self.0.default_span(tcx)
144 impl Key for (MirSuite, DefId) {
145 fn map_crate(&self) -> CrateNum {
148 fn default_span(&self, tcx: TyCtxt) -> Span {
149 self.1.default_span(tcx)
153 impl Key for (MirSuite, MirPassIndex, DefId) {
154 fn map_crate(&self) -> CrateNum {
157 fn default_span(&self, tcx: TyCtxt) -> Span {
158 self.2.default_span(tcx)
162 impl<'tcx, T: Clone + Hash + Eq + Debug> Key for ty::ParamEnvAnd<'tcx, T> {
163 fn map_crate(&self) -> CrateNum {
166 fn default_span(&self, _: TyCtxt) -> Span {
171 trait Value<'tcx>: Sized {
172 fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self;
175 impl<'tcx, T> Value<'tcx> for T {
176 default fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> T {
177 tcx.sess.abort_if_errors();
178 bug!("Value::from_cycle_error called without errors");
182 impl<'tcx, T: Default> Value<'tcx> for T {
183 default fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> T {
188 impl<'tcx> Value<'tcx> for Ty<'tcx> {
189 fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> {
194 impl<'tcx> Value<'tcx> for ty::DtorckConstraint<'tcx> {
195 fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
200 impl<'tcx> Value<'tcx> for ty::SymbolName {
201 fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
202 ty::SymbolName { name: Symbol::intern("<error>").as_str() }
206 struct QueryMap<D: QueryDescription> {
207 phantom: PhantomData<D>,
208 map: FxHashMap<D::Key, QueryValue<D::Value>>,
211 struct QueryValue<T> {
214 diagnostics: Option<Box<QueryDiagnostics>>,
217 struct QueryDiagnostics {
218 diagnostics: Vec<Diagnostic>,
219 emitted_diagnostics: Cell<bool>,
222 impl<M: QueryDescription> QueryMap<M> {
223 fn new() -> QueryMap<M> {
225 phantom: PhantomData,
231 struct CycleError<'a, 'tcx: 'a> {
233 cycle: RefMut<'a, [(Span, Query<'tcx>)]>,
236 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
237 fn report_cycle(self, CycleError { span, cycle }: CycleError)
238 -> DiagnosticBuilder<'a>
240 // Subtle: release the refcell lock before invoking `describe()`
241 // below by dropping `cycle`.
242 let stack = cycle.to_vec();
245 assert!(!stack.is_empty());
247 // Disable naming impls with types in this path, since that
248 // sometimes cycles itself, leading to extra cycle errors.
249 // (And cycle errors around impls tend to occur during the
250 // collect/coherence phases anyhow.)
251 item_path::with_forced_impl_filename_line(|| {
253 struct_span_err!(self.sess, span, E0391,
254 "unsupported cyclic reference between types/traits detected");
255 err.span_label(span, "cyclic reference");
257 err.span_note(stack[0].0, &format!("the cycle begins when {}...",
258 stack[0].1.describe(self)));
260 for &(span, ref query) in &stack[1..] {
261 err.span_note(span, &format!("...which then requires {}...",
262 query.describe(self)));
265 err.note(&format!("...which then again requires {}, completing the cycle.",
266 stack[0].1.describe(self)));
272 fn cycle_check<F, R>(self, span: Span, query: Query<'gcx>, compute: F)
273 -> Result<R, CycleError<'a, 'gcx>>
274 where F: FnOnce() -> R
277 let mut stack = self.maps.query_stack.borrow_mut();
278 if let Some((i, _)) = stack.iter().enumerate().rev()
279 .find(|&(_, &(_, ref q))| *q == query) {
280 return Err(CycleError {
282 cycle: RefMut::map(stack, |stack| &mut stack[i..])
285 stack.push((span, query));
288 let result = compute();
290 self.maps.query_stack.borrow_mut().pop();
296 pub trait QueryConfig {
297 type Key: Eq + Hash + Clone;
301 trait QueryDescription: QueryConfig {
302 fn describe(tcx: TyCtxt, key: Self::Key) -> String;
305 impl<M: QueryConfig<Key=DefId>> QueryDescription for M {
306 default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
307 format!("processing `{}`", tcx.item_path_str(def_id))
311 impl<'tcx> QueryDescription for queries::is_copy_raw<'tcx> {
312 fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
313 format!("computing whether `{}` is `Copy`", env.value)
317 impl<'tcx> QueryDescription for queries::is_sized_raw<'tcx> {
318 fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
319 format!("computing whether `{}` is `Sized`", env.value)
323 impl<'tcx> QueryDescription for queries::is_freeze_raw<'tcx> {
324 fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
325 format!("computing whether `{}` is freeze", env.value)
329 impl<'tcx> QueryDescription for queries::needs_drop_raw<'tcx> {
330 fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
331 format!("computing whether `{}` needs drop", env.value)
335 impl<'tcx> QueryDescription for queries::layout_raw<'tcx> {
336 fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
337 format!("computing layout of `{}`", env.value)
341 impl<'tcx> QueryDescription for queries::super_predicates_of<'tcx> {
342 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
343 format!("computing the supertraits of `{}`",
344 tcx.item_path_str(def_id))
348 impl<'tcx> QueryDescription for queries::type_param_predicates<'tcx> {
349 fn describe(tcx: TyCtxt, (_, def_id): (DefId, DefId)) -> String {
350 let id = tcx.hir.as_local_node_id(def_id).unwrap();
351 format!("computing the bounds for type parameter `{}`",
352 tcx.hir.ty_param_name(id))
356 impl<'tcx> QueryDescription for queries::coherent_trait<'tcx> {
357 fn describe(tcx: TyCtxt, (_, def_id): (CrateNum, DefId)) -> String {
358 format!("coherence checking all impls of trait `{}`",
359 tcx.item_path_str(def_id))
363 impl<'tcx> QueryDescription for queries::crate_inherent_impls<'tcx> {
364 fn describe(_: TyCtxt, k: CrateNum) -> String {
365 format!("all inherent impls defined in crate `{:?}`", k)
369 impl<'tcx> QueryDescription for queries::crate_inherent_impls_overlap_check<'tcx> {
370 fn describe(_: TyCtxt, _: CrateNum) -> String {
371 format!("check for overlap between inherent impls defined in this crate")
375 impl<'tcx> QueryDescription for queries::crate_variances<'tcx> {
376 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
377 format!("computing the variances for items in this crate")
381 impl<'tcx> QueryDescription for queries::mir_shims<'tcx> {
382 fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
383 format!("generating MIR shim for `{}`",
384 tcx.item_path_str(def.def_id()))
388 impl<'tcx> QueryDescription for queries::privacy_access_levels<'tcx> {
389 fn describe(_: TyCtxt, _: CrateNum) -> String {
390 format!("privacy access levels")
394 impl<'tcx> QueryDescription for queries::typeck_item_bodies<'tcx> {
395 fn describe(_: TyCtxt, _: CrateNum) -> String {
396 format!("type-checking all item bodies")
400 impl<'tcx> QueryDescription for queries::reachable_set<'tcx> {
401 fn describe(_: TyCtxt, _: CrateNum) -> String {
402 format!("reachability")
406 impl<'tcx> QueryDescription for queries::const_eval<'tcx> {
407 fn describe(tcx: TyCtxt, key: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>) -> String {
408 format!("const-evaluating `{}`", tcx.item_path_str(key.value.0))
412 impl<'tcx> QueryDescription for queries::mir_keys<'tcx> {
413 fn describe(_: TyCtxt, _: CrateNum) -> String {
414 format!("getting a list of all mir_keys")
418 impl<'tcx> QueryDescription for queries::symbol_name<'tcx> {
419 fn describe(_tcx: TyCtxt, instance: ty::Instance<'tcx>) -> String {
420 format!("computing the symbol for `{}`", instance)
424 impl<'tcx> QueryDescription for queries::describe_def<'tcx> {
425 fn describe(_: TyCtxt, _: DefId) -> String {
430 impl<'tcx> QueryDescription for queries::def_span<'tcx> {
431 fn describe(_: TyCtxt, _: DefId) -> String {
437 impl<'tcx> QueryDescription for queries::lookup_stability<'tcx> {
438 fn describe(_: TyCtxt, _: DefId) -> String {
443 impl<'tcx> QueryDescription for queries::lookup_deprecation_entry<'tcx> {
444 fn describe(_: TyCtxt, _: DefId) -> String {
449 impl<'tcx> QueryDescription for queries::item_attrs<'tcx> {
450 fn describe(_: TyCtxt, _: DefId) -> String {
455 impl<'tcx> QueryDescription for queries::is_exported_symbol<'tcx> {
456 fn describe(_: TyCtxt, _: DefId) -> String {
457 bug!("is_exported_symbol")
461 impl<'tcx> QueryDescription for queries::fn_arg_names<'tcx> {
462 fn describe(_: TyCtxt, _: DefId) -> String {
467 impl<'tcx> QueryDescription for queries::impl_parent<'tcx> {
468 fn describe(_: TyCtxt, _: DefId) -> String {
473 impl<'tcx> QueryDescription for queries::trait_of_item<'tcx> {
474 fn describe(_: TyCtxt, _: DefId) -> String {
475 bug!("trait_of_item")
479 impl<'tcx> QueryDescription for queries::item_body_nested_bodies<'tcx> {
480 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
481 format!("nested item bodies of `{}`", tcx.item_path_str(def_id))
485 impl<'tcx> QueryDescription for queries::const_is_rvalue_promotable_to_static<'tcx> {
486 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
487 format!("const checking if rvalue is promotable to static `{}`",
488 tcx.item_path_str(def_id))
492 impl<'tcx> QueryDescription for queries::is_mir_available<'tcx> {
493 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
494 format!("checking if item is mir available: `{}`",
495 tcx.item_path_str(def_id))
499 impl<'tcx> QueryDescription for queries::trait_impls_of<'tcx> {
500 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
501 format!("trait impls of `{}`", tcx.item_path_str(def_id))
505 impl<'tcx> QueryDescription for queries::is_object_safe<'tcx> {
506 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
507 format!("determine object safety of trait `{}`", tcx.item_path_str(def_id))
511 impl<'tcx> QueryDescription for queries::is_const_fn<'tcx> {
512 fn describe(tcx: TyCtxt, def_id: DefId) -> String {
513 format!("checking if item is const fn: `{}`", tcx.item_path_str(def_id))
517 impl<'tcx> QueryDescription for queries::dylib_dependency_formats<'tcx> {
518 fn describe(_: TyCtxt, _: CrateNum) -> String {
519 "dylib dependency formats of crate".to_string()
523 impl<'tcx> QueryDescription for queries::is_panic_runtime<'tcx> {
524 fn describe(_: TyCtxt, _: CrateNum) -> String {
525 "checking if the crate is_panic_runtime".to_string()
529 impl<'tcx> QueryDescription for queries::is_compiler_builtins<'tcx> {
530 fn describe(_: TyCtxt, _: CrateNum) -> String {
531 "checking if the crate is_compiler_builtins".to_string()
535 impl<'tcx> QueryDescription for queries::has_global_allocator<'tcx> {
536 fn describe(_: TyCtxt, _: CrateNum) -> String {
537 "checking if the crate has_global_allocator".to_string()
541 impl<'tcx> QueryDescription for queries::extern_crate<'tcx> {
542 fn describe(_: TyCtxt, _: DefId) -> String {
543 "getting crate's ExternCrateData".to_string()
547 impl<'tcx> QueryDescription for queries::lint_levels<'tcx> {
548 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
549 format!("computing the lint levels for items in this crate")
553 impl<'tcx> QueryDescription for queries::specializes<'tcx> {
554 fn describe(_tcx: TyCtxt, _: (DefId, DefId)) -> String {
555 format!("computing whether impls specialize one another")
559 impl<'tcx> QueryDescription for queries::in_scope_traits_map<'tcx> {
560 fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
561 format!("traits in scope at a block")
565 impl<'tcx> QueryDescription for queries::is_no_builtins<'tcx> {
566 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
567 format!("test whether a crate has #![no_builtins]")
571 impl<'tcx> QueryDescription for queries::panic_strategy<'tcx> {
572 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
573 format!("query a crate's configured panic strategy")
577 impl<'tcx> QueryDescription for queries::is_profiler_runtime<'tcx> {
578 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
579 format!("query a crate is #![profiler_runtime]")
583 impl<'tcx> QueryDescription for queries::is_sanitizer_runtime<'tcx> {
584 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
585 format!("query a crate is #![sanitizer_runtime]")
589 impl<'tcx> QueryDescription for queries::exported_symbols<'tcx> {
590 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
591 format!("looking up the exported symbols of a crate")
595 impl<'tcx> QueryDescription for queries::native_libraries<'tcx> {
596 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
597 format!("looking up the native libraries of a linked crate")
601 impl<'tcx> QueryDescription for queries::plugin_registrar_fn<'tcx> {
602 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
603 format!("looking up the plugin registrar for a crate")
607 impl<'tcx> QueryDescription for queries::derive_registrar_fn<'tcx> {
608 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
609 format!("looking up the derive registrar for a crate")
613 impl<'tcx> QueryDescription for queries::crate_disambiguator<'tcx> {
614 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
615 format!("looking up the disambiguator a crate")
619 impl<'tcx> QueryDescription for queries::crate_hash<'tcx> {
620 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
621 format!("looking up the hash a crate")
625 impl<'tcx> QueryDescription for queries::original_crate_name<'tcx> {
626 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
627 format!("looking up the original name a crate")
631 impl<'tcx> QueryDescription for queries::implementations_of_trait<'tcx> {
632 fn describe(_tcx: TyCtxt, _: (CrateNum, DefId)) -> String {
633 format!("looking up implementations of a trait in a crate")
637 impl<'tcx> QueryDescription for queries::all_trait_implementations<'tcx> {
638 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
639 format!("looking up all (?) trait implementations")
643 impl<'tcx> QueryDescription for queries::link_args<'tcx> {
644 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
645 format!("looking up link arguments for a crate")
649 impl<'tcx> QueryDescription for queries::named_region_map<'tcx> {
650 fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
651 format!("looking up a named region")
655 impl<'tcx> QueryDescription for queries::is_late_bound_map<'tcx> {
656 fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
657 format!("testing if a region is late boudn")
661 impl<'tcx> QueryDescription for queries::object_lifetime_defaults_map<'tcx> {
662 fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
663 format!("looking up lifetime defaults for a region")
667 impl<'tcx> QueryDescription for queries::dep_kind<'tcx> {
668 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
669 format!("fetching what a dependency looks like")
673 impl<'tcx> QueryDescription for queries::crate_name<'tcx> {
674 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
675 format!("fetching what a crate is named")
679 impl<'tcx> QueryDescription for queries::get_lang_items<'tcx> {
680 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
681 format!("calculating the lang items map")
685 impl<'tcx> QueryDescription for queries::defined_lang_items<'tcx> {
686 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
687 format!("calculating the lang items defined in a crate")
691 impl<'tcx> QueryDescription for queries::missing_lang_items<'tcx> {
692 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
693 format!("calculating the missing lang items in a crate")
697 impl<'tcx> QueryDescription for queries::visible_parent_map<'tcx> {
698 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
699 format!("calculating the visible parent map")
703 impl<'tcx> QueryDescription for queries::missing_extern_crate_item<'tcx> {
704 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
705 format!("seeing if we're missing an `extern crate` item for this crate")
709 impl<'tcx> QueryDescription for queries::used_crate_source<'tcx> {
710 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
711 format!("looking at the source for a crate")
715 impl<'tcx> QueryDescription for queries::postorder_cnums<'tcx> {
716 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
717 format!("generating a postorder list of CrateNums")
721 impl<'tcx> QueryDescription for queries::maybe_unused_extern_crates<'tcx> {
722 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
723 format!("looking up all possibly unused extern crates")
727 impl<'tcx> QueryDescription for queries::stability_index<'tcx> {
728 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
729 format!("calculating the stability index for the local crate")
733 impl<'tcx> QueryDescription for queries::all_crate_nums<'tcx> {
734 fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
735 format!("fetching all foreign CrateNum instances")
739 // If enabled, send a message to the profile-queries thread
740 macro_rules! profq_msg {
741 ($tcx:expr, $msg:expr) => {
742 if cfg!(debug_assertions) {
743 if $tcx.sess.profile_queries() {
750 // If enabled, format a key using its debug string, which can be
751 // expensive to compute (in terms of time).
752 macro_rules! profq_key {
753 ($tcx:expr, $key:expr) => {
754 if cfg!(debug_assertions) {
755 if $tcx.sess.profile_queries_and_keys() {
756 Some(format!("{:?}", $key))
762 macro_rules! define_maps {
765 [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
768 input: ($(([$($modifiers)*] [$($attr)*] [$name]))*)
771 impl<$tcx> Maps<$tcx> {
772 pub fn new(providers: IndexVec<CrateNum, Providers<$tcx>>)
776 query_stack: RefCell::new(vec![]),
777 $($name: RefCell::new(QueryMap::new())),*
783 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
784 pub enum Query<$tcx> {
785 $($(#[$attr])* $name($K)),*
789 #[derive(Clone, Debug, PartialEq, Eq)]
791 $($name(Option<String>)),*
794 impl<$tcx> Query<$tcx> {
795 pub fn describe(&self, tcx: TyCtxt) -> String {
796 let (r, name) = match *self {
797 $(Query::$name(key) => {
798 (queries::$name::describe(tcx, key), stringify!($name))
801 if tcx.sess.verbose() {
802 format!("{} [{}]", r, name)
810 use std::marker::PhantomData;
812 $(#[allow(bad_style)]
813 pub struct $name<$tcx> {
814 data: PhantomData<&$tcx ()>
818 $(impl<$tcx> QueryConfig for queries::$name<$tcx> {
823 impl<'a, $tcx, 'lcx> queries::$name<$tcx> {
825 fn to_dep_node(tcx: TyCtxt<'a, $tcx, 'lcx>, key: &$K) -> DepNode {
826 use dep_graph::DepConstructor::*;
828 DepNode::new(tcx, $node(*key))
831 fn try_get_with<F, R>(tcx: TyCtxt<'a, $tcx, 'lcx>,
835 -> Result<R, CycleError<'a, $tcx>>
836 where F: FnOnce(&$V) -> R
838 debug!("ty::queries::{}::try_get_with(key={:?}, span={:?})",
844 ProfileQueriesMsg::QueryBegin(
846 QueryMsg::$name(profq_key!(tcx, key))
850 if let Some(value) = tcx.maps.$name.borrow().map.get(&key) {
851 if let Some(ref d) = value.diagnostics {
852 if !d.emitted_diagnostics.get() {
853 d.emitted_diagnostics.set(true);
854 let handle = tcx.sess.diagnostic();
855 for diagnostic in d.diagnostics.iter() {
856 DiagnosticBuilder::new_diagnostic(handle, diagnostic.clone())
861 profq_msg!(tcx, ProfileQueriesMsg::CacheHit);
862 tcx.dep_graph.read_index(value.index);
863 return Ok(f(&value.value));
865 // else, we are going to run the provider:
866 profq_msg!(tcx, ProfileQueriesMsg::ProviderBegin);
868 // FIXME(eddyb) Get more valid Span's on queries.
869 // def_span guard is necessary to prevent a recursive loop,
870 // default_span calls def_span query internally.
871 if span == DUMMY_SP && stringify!($name) != "def_span" {
872 span = key.default_span(tcx)
875 let res = tcx.cycle_check(span, Query::$name(key), || {
876 let dep_node = Self::to_dep_node(tcx, &key);
878 tcx.sess.diagnostic().track_diagnostics(|| {
879 if dep_node.kind.is_anon() {
880 tcx.dep_graph.with_anon_task(dep_node.kind, || {
881 let provider = tcx.maps.providers[key.map_crate()].$name;
882 provider(tcx.global_tcx(), key)
885 fn run_provider<'a, 'tcx, 'lcx>(tcx: TyCtxt<'a, 'tcx, 'lcx>,
888 let provider = tcx.maps.providers[key.map_crate()].$name;
889 provider(tcx.global_tcx(), key)
892 tcx.dep_graph.with_task(dep_node, tcx, key, run_provider)
896 profq_msg!(tcx, ProfileQueriesMsg::ProviderEnd);
897 let ((result, dep_node_index), diagnostics) = res;
899 tcx.dep_graph.read_index(dep_node_index);
901 let value = QueryValue {
903 index: dep_node_index,
904 diagnostics: if diagnostics.len() == 0 {
907 Some(Box::new(QueryDiagnostics {
909 emitted_diagnostics: Cell::new(true),
923 pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
924 -> Result<$V, DiagnosticBuilder<'a>> {
925 match Self::try_get_with(tcx, span, key, Clone::clone) {
927 Err(e) => Err(tcx.report_cycle(e)),
931 pub fn force(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K) {
932 // Ignore dependencies, since we not reading the computed value
933 let _task = tcx.dep_graph.in_ignore();
935 match Self::try_get_with(tcx, span, key, |_| ()) {
937 Err(e) => tcx.report_cycle(e).emit(),
942 #[derive(Copy, Clone)]
943 pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
944 pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
948 impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> {
949 type Target = TyCtxt<'a, 'gcx, 'tcx>;
950 fn deref(&self) -> &Self::Target {
955 impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> {
956 /// Return a transparent wrapper for `TyCtxt` which uses
957 /// `span` as the location of queries performed through it.
958 pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> {
966 pub fn $name(self, key: $K) -> $V {
967 self.at(DUMMY_SP).$name(key)
971 impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
973 pub fn $name(self, key: $K) -> $V {
974 queries::$name::try_get(self.tcx, self.span, key).unwrap_or_else(|mut e| {
976 Value::from_cycle_error(self.global_tcx())
981 define_provider_struct! {
983 input: ($(([$($modifiers)*] [$name] [$K] [$V]))*),
987 impl<$tcx> Copy for Providers<$tcx> {}
988 impl<$tcx> Clone for Providers<$tcx> {
989 fn clone(&self) -> Self { *self }
994 macro_rules! define_map_struct {
997 input: $input:tt) => {
1008 output: ($($output:tt)*)) => {
1009 pub struct Maps<$tcx> {
1010 providers: IndexVec<CrateNum, Providers<$tcx>>,
1011 query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
1016 // Field recognized and ready to shift into the output
1018 ready: ([$($pub:tt)*] [$($attr:tt)*] [$name:ident]),
1020 output: ($($output:tt)*)) => {
1021 define_map_struct! {
1024 output: ($($output)*
1025 $(#[$attr])* $($pub)* $name: RefCell<QueryMap<queries::$name<$tcx>>>,)
1029 // No modifiers left? This is a private item.
1031 input: (([] $attrs:tt $name:tt) $($input:tt)*),
1032 output: $output:tt) => {
1033 define_map_struct! {
1035 ready: ([] $attrs $name),
1036 input: ($($input)*),
1041 // Skip other modifiers
1043 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
1044 output: $output:tt) => {
1045 define_map_struct! {
1047 input: (([$($modifiers)*] $($fields)*) $($input)*),
1053 macro_rules! define_provider_struct {
1055 (tcx: $tcx:tt, input: $input:tt) => {
1056 define_provider_struct! {
1066 output: ($(([$name:ident] [$K:ty] [$R:ty]))*)) => {
1067 pub struct Providers<$tcx> {
1068 $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $R,)*
1071 impl<$tcx> Default for Providers<$tcx> {
1072 fn default() -> Self {
1073 $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R {
1074 bug!("tcx.maps.{}({:?}) unsupported by its crate",
1075 stringify!($name), key);
1077 Providers { $($name),* }
1082 // Something ready to shift:
1084 ready: ($name:tt $K:tt $V:tt),
1086 output: ($($output:tt)*)) => {
1087 define_provider_struct! {
1090 output: ($($output)* ($name $K $V))
1094 // Regular queries produce a `V` only.
1096 input: (([] $name:tt $K:tt $V:tt) $($input:tt)*),
1097 output: $output:tt) => {
1098 define_provider_struct! {
1100 ready: ($name $K $V),
1101 input: ($($input)*),
1108 input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
1109 output: $output:tt) => {
1110 define_provider_struct! {
1112 input: (([$($modifiers)*] $($fields)*) $($input)*),
1118 // Each of these maps also corresponds to a method on a
1119 // `Provider` trait for requesting a value of that type,
1120 // and a method on `Maps` itself for doing that in a
1121 // a way that memoizes and does dep-graph tracking,
1122 // wrapping around the actual chain of providers that
1123 // the driver creates (using several `rustc_*` crates).
1124 define_maps! { <'tcx>
1125 /// Records the type of every item.
1126 [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
1128 /// Maps from the def-id of an item (trait/struct/enum/fn) to its
1129 /// associated generics and predicates.
1130 [] fn generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics,
1131 [] fn predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
1133 /// Maps from the def-id of a trait to the list of
1134 /// super-predicates. This is a subset of the full list of
1135 /// predicates. We store these in a separate map because we must
1136 /// evaluate them even during type conversion, often before the
1137 /// full predicates are available (note that supertraits have
1138 /// additional acyclicity requirements).
1139 [] fn super_predicates_of: SuperPredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
1141 /// To avoid cycles within the predicates of a single item we compute
1142 /// per-type-parameter predicates for resolving `T::AssocTy`.
1143 [] fn type_param_predicates: type_param_predicates((DefId, DefId))
1144 -> ty::GenericPredicates<'tcx>,
1146 [] fn trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
1147 [] fn adt_def: AdtDefOfItem(DefId) -> &'tcx ty::AdtDef,
1148 [] fn adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
1149 [] fn adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
1150 [] fn adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
1152 /// True if this is a const fn
1153 [] fn is_const_fn: IsConstFn(DefId) -> bool,
1155 /// True if this is a foreign item (i.e., linked via `extern { ... }`).
1156 [] fn is_foreign_item: IsForeignItem(DefId) -> bool,
1158 /// True if this is a default impl (aka impl Foo for ..)
1159 [] fn is_default_impl: IsDefaultImpl(DefId) -> bool,
1161 /// Get a map with the variance of every item; use `item_variance`
1163 [] fn crate_variances: crate_variances(CrateNum) -> Rc<ty::CrateVariancesMap>,
1165 /// Maps from def-id of a type or region parameter to its
1166 /// (inferred) variance.
1167 [] fn variances_of: ItemVariances(DefId) -> Rc<Vec<ty::Variance>>,
1169 /// Maps from an impl/trait def-id to a list of the def-ids of its items
1170 [] fn associated_item_def_ids: AssociatedItemDefIds(DefId) -> Rc<Vec<DefId>>,
1172 /// Maps from a trait item to the trait item "descriptor"
1173 [] fn associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
1175 [] fn impl_trait_ref: ImplTraitRef(DefId) -> Option<ty::TraitRef<'tcx>>,
1176 [] fn impl_polarity: ImplPolarity(DefId) -> hir::ImplPolarity,
1178 /// Maps a DefId of a type to a list of its inherent impls.
1179 /// Contains implementations of methods that are inherent to a type.
1180 /// Methods in these implementations don't need to be exported.
1181 [] fn inherent_impls: InherentImpls(DefId) -> Rc<Vec<DefId>>,
1183 /// Set of all the def-ids in this crate that have MIR associated with
1184 /// them. This includes all the body owners, but also things like struct
1186 [] fn mir_keys: mir_keys(CrateNum) -> Rc<DefIdSet>,
1188 /// Maps DefId's that have an associated Mir to the result
1189 /// of the MIR qualify_consts pass. The actual meaning of
1190 /// the value isn't known except to the pass itself.
1191 [] fn mir_const_qualif: MirConstQualif(DefId) -> (u8, Rc<IdxSetBuf<mir::Local>>),
1193 /// Fetch the MIR for a given def-id up till the point where it is
1194 /// ready for const evaluation.
1196 /// See the README for the `mir` module for details.
1197 [] fn mir_const: MirConst(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
1199 [] fn mir_validated: MirValidated(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
1201 /// MIR after our optimization passes have run. This is MIR that is ready
1202 /// for trans. This is also the only query that can fetch non-local MIR, at present.
1203 [] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>,
1205 /// Type of each closure. The def ID is the ID of the
1206 /// expression defining the closure.
1207 [] fn closure_kind: ClosureKind(DefId) -> ty::ClosureKind,
1209 /// The signature of functions and closures.
1210 [] fn fn_sig: FnSignature(DefId) -> ty::PolyFnSig<'tcx>,
1212 /// Records the signature of each generator. The def ID is the ID of the
1213 /// expression defining the closure.
1214 [] fn generator_sig: GenSignature(DefId) -> Option<ty::PolyGenSig<'tcx>>,
1216 /// Caches CoerceUnsized kinds for impls on custom types.
1217 [] fn coerce_unsized_info: CoerceUnsizedInfo(DefId)
1218 -> ty::adjustment::CoerceUnsizedInfo,
1220 [] fn typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
1222 [] fn typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
1224 [] fn has_typeck_tables: HasTypeckTables(DefId) -> bool,
1226 [] fn coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
1228 [] fn borrowck: BorrowCheck(DefId) -> (),
1229 // FIXME: shouldn't this return a `Result<(), BorrowckErrors>` instead?
1230 [] fn mir_borrowck: MirBorrowCheck(DefId) -> (),
1232 /// Gets a complete map from all types to their inherent impls.
1233 /// Not meant to be used directly outside of coherence.
1234 /// (Defined only for LOCAL_CRATE)
1235 [] fn crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
1237 /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
1238 /// Not meant to be used directly outside of coherence.
1239 /// (Defined only for LOCAL_CRATE)
1240 [] fn crate_inherent_impls_overlap_check: inherent_impls_overlap_check_dep_node(CrateNum) -> (),
1242 /// Results of evaluating const items or constants embedded in
1243 /// other items (such as enum variant explicit discriminants).
1244 [] fn const_eval: const_eval_dep_node(ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
1245 -> const_val::EvalResult<'tcx>,
1247 /// Performs the privacy check and computes "access levels".
1248 [] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Rc<AccessLevels>,
1250 [] fn reachable_set: reachability_dep_node(CrateNum) -> Rc<NodeSet>,
1252 /// Per-body `region::ScopeTree`. The `DefId` should be the owner-def-id for the body;
1253 /// in the case of closures, this will be redirected to the enclosing function.
1254 [] fn region_scope_tree: RegionScopeTree(DefId) -> Rc<region::ScopeTree>,
1256 [] fn mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx>,
1258 [] fn def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
1259 [] fn symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName,
1261 [] fn describe_def: DescribeDef(DefId) -> Option<Def>,
1262 [] fn def_span: DefSpan(DefId) -> Span,
1263 [] fn lookup_stability: LookupStability(DefId) -> Option<&'tcx attr::Stability>,
1264 [] fn lookup_deprecation_entry: LookupDeprecationEntry(DefId) -> Option<DeprecationEntry>,
1265 [] fn item_attrs: ItemAttrs(DefId) -> Rc<[ast::Attribute]>,
1266 [] fn fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>,
1267 [] fn impl_parent: ImplParent(DefId) -> Option<DefId>,
1268 [] fn trait_of_item: TraitOfItem(DefId) -> Option<DefId>,
1269 [] fn is_exported_symbol: IsExportedSymbol(DefId) -> bool,
1270 [] fn item_body_nested_bodies: ItemBodyNestedBodies(DefId)
1271 -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
1272 [] fn const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
1273 [] fn is_mir_available: IsMirAvailable(DefId) -> bool,
1275 [] fn trait_impls_of: TraitImpls(DefId) -> Rc<ty::trait_def::TraitImpls>,
1276 [] fn specialization_graph_of: SpecializationGraph(DefId) -> Rc<specialization_graph::Graph>,
1277 [] fn is_object_safe: ObjectSafety(DefId) -> bool,
1279 // Get the ParameterEnvironment for a given item; this environment
1280 // will be in "user-facing" mode, meaning that it is suitabe for
1281 // type-checking etc, and it does not normalize specializable
1282 // associated types. This is almost always what you want,
1283 // unless you are doing MIR optimizations, in which case you
1284 // might want to use `reveal_all()` method to change modes.
1285 [] fn param_env: ParamEnv(DefId) -> ty::ParamEnv<'tcx>,
1287 // Trait selection queries. These are best used by invoking `ty.moves_by_default()`,
1288 // `ty.is_copy()`, etc, since that will prune the environment where possible.
1289 [] fn is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
1290 [] fn is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
1291 [] fn is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
1292 [] fn needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
1293 [] fn layout_raw: layout_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
1294 -> Result<&'tcx Layout, LayoutError<'tcx>>,
1296 [] fn dylib_dependency_formats: DylibDepFormats(CrateNum)
1297 -> Rc<Vec<(CrateNum, LinkagePreference)>>,
1299 [] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
1300 [] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
1301 [] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
1302 [] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
1303 [] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
1304 [] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,
1305 [] fn is_no_builtins: IsNoBuiltins(CrateNum) -> bool,
1307 [] fn extern_crate: ExternCrate(DefId) -> Rc<Option<ExternCrate>>,
1309 [] fn specializes: specializes_node((DefId, DefId)) -> bool,
1310 [] fn in_scope_traits_map: InScopeTraits(DefIndex)
1311 -> Option<Rc<FxHashMap<ItemLocalId, Rc<Vec<TraitCandidate>>>>>,
1312 [] fn module_exports: ModuleExports(DefId) -> Option<Rc<Vec<Export>>>,
1313 [] fn lint_levels: lint_levels_node(CrateNum) -> Rc<lint::LintLevelMap>,
1315 [] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
1316 [] fn exported_symbols: ExportedSymbols(CrateNum) -> Rc<Vec<DefId>>,
1317 [] fn native_libraries: NativeLibraries(CrateNum) -> Rc<Vec<NativeLibrary>>,
1318 [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
1319 [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
1320 [] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> Symbol,
1321 [] fn crate_hash: CrateHash(CrateNum) -> Svh,
1322 [] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
1324 [] fn implementations_of_trait: implementations_of_trait_node((CrateNum, DefId))
1326 [] fn all_trait_implementations: AllTraitImplementations(CrateNum)
1329 [] fn is_dllimport_foreign_item: IsDllimportForeignItem(DefId) -> bool,
1330 [] fn is_statically_included_foreign_item: IsStaticallyIncludedForeignItem(DefId) -> bool,
1331 [] fn native_library_kind: NativeLibraryKind(DefId)
1332 -> Option<NativeLibraryKind>,
1333 [] fn link_args: link_args_node(CrateNum) -> Rc<Vec<String>>,
1335 [] fn named_region_map: NamedRegion(DefIndex) ->
1336 Option<Rc<FxHashMap<ItemLocalId, Region>>>,
1337 [] fn is_late_bound_map: IsLateBound(DefIndex) ->
1338 Option<Rc<FxHashSet<ItemLocalId>>>,
1339 [] fn object_lifetime_defaults_map: ObjectLifetimeDefaults(DefIndex)
1340 -> Option<Rc<FxHashMap<ItemLocalId, Rc<Vec<ObjectLifetimeDefault>>>>>,
1342 [] fn visibility: Visibility(DefId) -> ty::Visibility,
1343 [] fn dep_kind: DepKind(CrateNum) -> DepKind,
1344 [] fn crate_name: CrateName(CrateNum) -> Symbol,
1345 [] fn item_children: ItemChildren(DefId) -> Rc<Vec<Export>>,
1346 [] fn extern_mod_stmt_cnum: ExternModStmtCnum(DefId) -> Option<CrateNum>,
1348 [] fn get_lang_items: get_lang_items_node(CrateNum) -> Rc<LanguageItems>,
1349 [] fn defined_lang_items: DefinedLangItems(CrateNum) -> Rc<Vec<(DefIndex, usize)>>,
1350 [] fn missing_lang_items: MissingLangItems(CrateNum) -> Rc<Vec<LangItem>>,
1351 [] fn extern_const_body: ExternConstBody(DefId) -> &'tcx hir::Body,
1352 [] fn visible_parent_map: visible_parent_map_node(CrateNum)
1353 -> Rc<DefIdMap<DefId>>,
1354 [] fn missing_extern_crate_item: MissingExternCrateItem(CrateNum) -> bool,
1355 [] fn used_crate_source: UsedCrateSource(CrateNum) -> Rc<CrateSource>,
1356 [] fn postorder_cnums: postorder_cnums_node(CrateNum) -> Rc<Vec<CrateNum>>,
1358 [] fn freevars: Freevars(DefId) -> Option<Rc<Vec<hir::Freevar>>>,
1359 [] fn maybe_unused_trait_import: MaybeUnusedTraitImport(DefId) -> bool,
1360 [] fn maybe_unused_extern_crates: maybe_unused_extern_crates_node(CrateNum)
1361 -> Rc<Vec<(DefId, Span)>>,
1363 [] fn stability_index: stability_index_node(CrateNum) -> Rc<stability::Index<'tcx>>,
1364 [] fn all_crate_nums: all_crate_nums_node(CrateNum) -> Rc<Vec<CrateNum>>,
1367 fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {
1368 DepConstructor::TypeParamPredicates {
1374 fn coherent_trait_dep_node<'tcx>((_, def_id): (CrateNum, DefId)) -> DepConstructor<'tcx> {
1375 DepConstructor::CoherenceCheckTrait(def_id)
1378 fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1379 DepConstructor::Coherence
1382 fn inherent_impls_overlap_check_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1383 DepConstructor::CoherenceInherentImplOverlapCheck
1386 fn reachability_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1387 DepConstructor::Reachability
1390 fn mir_shim_dep_node<'tcx>(instance_def: ty::InstanceDef<'tcx>) -> DepConstructor<'tcx> {
1391 DepConstructor::MirShim {
1396 fn symbol_name_dep_node<'tcx>(instance: ty::Instance<'tcx>) -> DepConstructor<'tcx> {
1397 DepConstructor::InstanceSymbolName { instance }
1400 fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1401 DepConstructor::TypeckBodiesKrate
1404 fn const_eval_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
1405 -> DepConstructor<'tcx> {
1406 DepConstructor::ConstEval
1409 fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1410 DepConstructor::MirKeys
1413 fn crate_variances<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1414 DepConstructor::CrateVariances
1417 fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1418 DepConstructor::IsCopy
1421 fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1422 DepConstructor::IsSized
1425 fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1426 DepConstructor::IsFreeze
1429 fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1430 DepConstructor::NeedsDrop
1433 fn layout_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1434 DepConstructor::Layout
1437 fn lint_levels_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1438 DepConstructor::LintLevels
1441 fn specializes_node<'tcx>((a, b): (DefId, DefId)) -> DepConstructor<'tcx> {
1442 DepConstructor::Specializes { impl1: a, impl2: b }
1445 fn implementations_of_trait_node<'tcx>((krate, trait_id): (CrateNum, DefId))
1446 -> DepConstructor<'tcx>
1448 DepConstructor::ImplementationsOfTrait { krate, trait_id }
1451 fn link_args_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1452 DepConstructor::LinkArgs
1455 fn get_lang_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1456 DepConstructor::GetLangItems
1459 fn visible_parent_map_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1460 DepConstructor::VisibleParentMap
1463 fn postorder_cnums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1464 DepConstructor::PostorderCnums
1467 fn maybe_unused_extern_crates_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1468 DepConstructor::MaybeUnusedExternCrates
1471 fn stability_index_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1472 DepConstructor::StabilityIndex
1475 fn all_crate_nums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
1476 DepConstructor::AllCrateNums