]> git.lizzy.rs Git - rust.git/blob - src/librustc/ty/maps/mod.rs
Auto merge of #45785 - arielb1:unsafe-fixes, r=eddyb
[rust.git] / src / librustc / ty / maps / mod.rs
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.
4 //
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.
10
11 use dep_graph::{DepConstructor, DepNode};
12 use errors::DiagnosticBuilder;
13 use hir::def_id::{CrateNum, DefId, DefIndex};
14 use hir::def::{Def, Export};
15 use hir::{self, TraitCandidate, ItemLocalId};
16 use hir::svh::Svh;
17 use lint;
18 use middle::borrowck::BorrowCheckResult;
19 use middle::const_val;
20 use middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary,
21                      ExternBodyNestedBodies};
22 use middle::cstore::{NativeLibraryKind, DepKind, CrateSource, ExternConstBody};
23 use middle::privacy::AccessLevels;
24 use middle::reachable::ReachableSet;
25 use middle::region;
26 use middle::resolve_lifetime::{Region, ObjectLifetimeDefault};
27 use middle::stability::{self, DeprecationEntry};
28 use middle::lang_items::{LanguageItems, LangItem};
29 use middle::exported_symbols::SymbolExportLevel;
30 use middle::trans::{CodegenUnit, Stats};
31 use mir;
32 use session::{CompileResult, CrateDisambiguator};
33 use session::config::OutputFilenames;
34 use traits::Vtable;
35 use traits::specialization_graph;
36 use ty::{self, CrateInherentImpls, Ty, TyCtxt};
37 use ty::layout::{Layout, LayoutError};
38 use ty::steal::Steal;
39 use ty::subst::Substs;
40 use util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
41 use util::common::{profq_msg, ProfileQueriesMsg};
42
43 use rustc_data_structures::indexed_set::IdxSetBuf;
44 use rustc_back::PanicStrategy;
45 use rustc_data_structures::indexed_vec::IndexVec;
46 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
47 use rustc_data_structures::stable_hasher::StableVec;
48
49 use std::ops::Deref;
50 use std::rc::Rc;
51 use std::sync::Arc;
52 use syntax_pos::{Span, DUMMY_SP};
53 use syntax_pos::symbol::InternedString;
54 use syntax::attr;
55 use syntax::ast;
56 use syntax::symbol::Symbol;
57
58 #[macro_use]
59 mod plumbing;
60 use self::plumbing::*;
61 pub use self::plumbing::force_from_dep_node;
62
63 mod keys;
64 pub use self::keys::Key;
65
66 mod values;
67 use self::values::Value;
68
69 mod config;
70 pub use self::config::QueryConfig;
71 use self::config::QueryDescription;
72
73 mod on_disk_cache;
74 pub use self::on_disk_cache::OnDiskCache;
75
76 // Each of these maps also corresponds to a method on a
77 // `Provider` trait for requesting a value of that type,
78 // and a method on `Maps` itself for doing that in a
79 // a way that memoizes and does dep-graph tracking,
80 // wrapping around the actual chain of providers that
81 // the driver creates (using several `rustc_*` crates).
82 define_maps! { <'tcx>
83     /// Records the type of every item.
84     [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
85
86     /// Maps from the def-id of an item (trait/struct/enum/fn) to its
87     /// associated generics and predicates.
88     [] fn generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics,
89     [] fn predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
90
91     /// Maps from the def-id of a trait to the list of
92     /// super-predicates. This is a subset of the full list of
93     /// predicates. We store these in a separate map because we must
94     /// evaluate them even during type conversion, often before the
95     /// full predicates are available (note that supertraits have
96     /// additional acyclicity requirements).
97     [] fn super_predicates_of: SuperPredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
98
99     /// To avoid cycles within the predicates of a single item we compute
100     /// per-type-parameter predicates for resolving `T::AssocTy`.
101     [] fn type_param_predicates: type_param_predicates((DefId, DefId))
102         -> ty::GenericPredicates<'tcx>,
103
104     [] fn trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
105     [] fn adt_def: AdtDefOfItem(DefId) -> &'tcx ty::AdtDef,
106     [] fn adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
107     [] fn adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
108     [] fn adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
109
110     /// True if this is a const fn
111     [] fn is_const_fn: IsConstFn(DefId) -> bool,
112
113     /// True if this is a foreign item (i.e., linked via `extern { ... }`).
114     [] fn is_foreign_item: IsForeignItem(DefId) -> bool,
115
116     /// True if this is an auto impl (aka impl Foo for ..)
117     [] fn is_auto_impl: IsAutoImpl(DefId) -> bool,
118
119     /// Get a map with the variance of every item; use `item_variance`
120     /// instead.
121     [] fn crate_variances: crate_variances(CrateNum) -> Rc<ty::CrateVariancesMap>,
122
123     /// Maps from def-id of a type or region parameter to its
124     /// (inferred) variance.
125     [] fn variances_of: ItemVariances(DefId) -> Rc<Vec<ty::Variance>>,
126
127     /// Maps from def-id of a type to its (inferred) outlives.
128     [] fn inferred_outlives_of: InferredOutlivesOf(DefId) -> Vec<ty::Predicate<'tcx>>,
129
130     /// Maps from an impl/trait def-id to a list of the def-ids of its items
131     [] fn associated_item_def_ids: AssociatedItemDefIds(DefId) -> Rc<Vec<DefId>>,
132
133     /// Maps from a trait item to the trait item "descriptor"
134     [] fn associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
135
136     [] fn impl_trait_ref: ImplTraitRef(DefId) -> Option<ty::TraitRef<'tcx>>,
137     [] fn impl_polarity: ImplPolarity(DefId) -> hir::ImplPolarity,
138
139     /// Maps a DefId of a type to a list of its inherent impls.
140     /// Contains implementations of methods that are inherent to a type.
141     /// Methods in these implementations don't need to be exported.
142     [] fn inherent_impls: InherentImpls(DefId) -> Rc<Vec<DefId>>,
143
144     /// Set of all the def-ids in this crate that have MIR associated with
145     /// them. This includes all the body owners, but also things like struct
146     /// constructors.
147     [] fn mir_keys: mir_keys(CrateNum) -> Rc<DefIdSet>,
148
149     /// Maps DefId's that have an associated Mir to the result
150     /// of the MIR qualify_consts pass. The actual meaning of
151     /// the value isn't known except to the pass itself.
152     [] fn mir_const_qualif: MirConstQualif(DefId) -> (u8, Rc<IdxSetBuf<mir::Local>>),
153
154     /// Fetch the MIR for a given def-id right after it's built - this includes
155     /// unreachable code.
156     [] fn mir_built: MirBuilt(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
157
158     /// Fetch the MIR for a given def-id up till the point where it is
159     /// ready for const evaluation.
160     ///
161     /// See the README for the `mir` module for details.
162     [] fn mir_const: MirConst(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
163
164     [] fn mir_validated: MirValidated(DefId) -> &'tcx Steal<mir::Mir<'tcx>>,
165
166     /// MIR after our optimization passes have run. This is MIR that is ready
167     /// for trans. This is also the only query that can fetch non-local MIR, at present.
168     [] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>,
169
170     /// Type of each closure. The def ID is the ID of the
171     /// expression defining the closure.
172     [] fn closure_kind: ClosureKind(DefId) -> ty::ClosureKind,
173
174     /// The result of unsafety-checking this def-id.
175     [] fn unsafety_check_result: UnsafetyCheckResult(DefId) -> mir::UnsafetyCheckResult,
176
177     /// The signature of functions and closures.
178     [] fn fn_sig: FnSignature(DefId) -> ty::PolyFnSig<'tcx>,
179
180     /// Records the signature of each generator. The def ID is the ID of the
181     /// expression defining the closure.
182     [] fn generator_sig: GenSignature(DefId) -> Option<ty::PolyGenSig<'tcx>>,
183
184     /// Caches CoerceUnsized kinds for impls on custom types.
185     [] fn coerce_unsized_info: CoerceUnsizedInfo(DefId)
186         -> ty::adjustment::CoerceUnsizedInfo,
187
188     [] fn typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
189
190     [] fn typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
191
192     [] fn used_trait_imports: UsedTraitImports(DefId) -> Rc<DefIdSet>,
193
194     [] fn has_typeck_tables: HasTypeckTables(DefId) -> bool,
195
196     [] fn coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
197
198     [] fn borrowck: BorrowCheck(DefId) -> Rc<BorrowCheckResult>,
199     // FIXME: shouldn't this return a `Result<(), BorrowckErrors>` instead?
200     [] fn mir_borrowck: MirBorrowCheck(DefId) -> (),
201
202     /// Gets a complete map from all types to their inherent impls.
203     /// Not meant to be used directly outside of coherence.
204     /// (Defined only for LOCAL_CRATE)
205     [] fn crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
206
207     /// Checks all types in the krate for overlap in their inherent impls. Reports errors.
208     /// Not meant to be used directly outside of coherence.
209     /// (Defined only for LOCAL_CRATE)
210     [] fn crate_inherent_impls_overlap_check: inherent_impls_overlap_check_dep_node(CrateNum) -> (),
211
212     /// Results of evaluating const items or constants embedded in
213     /// other items (such as enum variant explicit discriminants).
214     [] fn const_eval: const_eval_dep_node(ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
215         -> const_val::EvalResult<'tcx>,
216
217     /// Performs the privacy check and computes "access levels".
218     [] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Rc<AccessLevels>,
219
220     [] fn reachable_set: reachability_dep_node(CrateNum) -> ReachableSet,
221
222     /// Per-body `region::ScopeTree`. The `DefId` should be the owner-def-id for the body;
223     /// in the case of closures, this will be redirected to the enclosing function.
224     [] fn region_scope_tree: RegionScopeTree(DefId) -> Rc<region::ScopeTree>,
225
226     [] fn mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx>,
227
228     [] fn def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
229     [] fn symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName,
230
231     [] fn describe_def: DescribeDef(DefId) -> Option<Def>,
232     [] fn def_span: DefSpan(DefId) -> Span,
233     [] fn lookup_stability: LookupStability(DefId) -> Option<&'tcx attr::Stability>,
234     [] fn lookup_deprecation_entry: LookupDeprecationEntry(DefId) -> Option<DeprecationEntry>,
235     [] fn item_attrs: ItemAttrs(DefId) -> Rc<[ast::Attribute]>,
236     [] fn fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>,
237     [] fn impl_parent: ImplParent(DefId) -> Option<DefId>,
238     [] fn trait_of_item: TraitOfItem(DefId) -> Option<DefId>,
239     [] fn is_exported_symbol: IsExportedSymbol(DefId) -> bool,
240     [] fn item_body_nested_bodies: ItemBodyNestedBodies(DefId) -> ExternBodyNestedBodies,
241     [] fn const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
242     [] fn rvalue_promotable_map: RvaluePromotableMap(DefId) -> Rc<ItemLocalSet>,
243     [] fn is_mir_available: IsMirAvailable(DefId) -> bool,
244     [] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>)
245                           -> Rc<Vec<Option<(DefId, &'tcx Substs<'tcx>)>>>,
246
247     [] fn trans_fulfill_obligation: fulfill_obligation_dep_node(
248         (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()>,
249     [] fn trait_impls_of: TraitImpls(DefId) -> Rc<ty::trait_def::TraitImpls>,
250     [] fn specialization_graph_of: SpecializationGraph(DefId) -> Rc<specialization_graph::Graph>,
251     [] fn is_object_safe: ObjectSafety(DefId) -> bool,
252
253     // Get the ParameterEnvironment for a given item; this environment
254     // will be in "user-facing" mode, meaning that it is suitabe for
255     // type-checking etc, and it does not normalize specializable
256     // associated types. This is almost always what you want,
257     // unless you are doing MIR optimizations, in which case you
258     // might want to use `reveal_all()` method to change modes.
259     [] fn param_env: ParamEnv(DefId) -> ty::ParamEnv<'tcx>,
260
261     // Trait selection queries. These are best used by invoking `ty.moves_by_default()`,
262     // `ty.is_copy()`, etc, since that will prune the environment where possible.
263     [] fn is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
264     [] fn is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
265     [] fn is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
266     [] fn needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
267     [] fn layout_raw: layout_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
268                                   -> Result<&'tcx Layout, LayoutError<'tcx>>,
269
270     [] fn dylib_dependency_formats: DylibDepFormats(CrateNum)
271                                     -> Rc<Vec<(CrateNum, LinkagePreference)>>,
272
273     [] fn is_panic_runtime: IsPanicRuntime(CrateNum) -> bool,
274     [] fn is_compiler_builtins: IsCompilerBuiltins(CrateNum) -> bool,
275     [] fn has_global_allocator: HasGlobalAllocator(CrateNum) -> bool,
276     [] fn is_sanitizer_runtime: IsSanitizerRuntime(CrateNum) -> bool,
277     [] fn is_profiler_runtime: IsProfilerRuntime(CrateNum) -> bool,
278     [] fn panic_strategy: GetPanicStrategy(CrateNum) -> PanicStrategy,
279     [] fn is_no_builtins: IsNoBuiltins(CrateNum) -> bool,
280
281     [] fn extern_crate: ExternCrate(DefId) -> Rc<Option<ExternCrate>>,
282
283     [] fn specializes: specializes_node((DefId, DefId)) -> bool,
284     [] fn in_scope_traits_map: InScopeTraits(DefIndex)
285         -> Option<Rc<FxHashMap<ItemLocalId, Rc<StableVec<TraitCandidate>>>>>,
286     [] fn module_exports: ModuleExports(DefId) -> Option<Rc<Vec<Export>>>,
287     [] fn lint_levels: lint_levels_node(CrateNum) -> Rc<lint::LintLevelMap>,
288
289     [] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
290     [] fn exported_symbol_ids: ExportedSymbolIds(CrateNum) -> Rc<DefIdSet>,
291     [] fn native_libraries: NativeLibraries(CrateNum) -> Rc<Vec<NativeLibrary>>,
292     [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
293     [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
294     [] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> CrateDisambiguator,
295     [] fn crate_hash: CrateHash(CrateNum) -> Svh,
296     [] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
297
298     [] fn implementations_of_trait: implementations_of_trait_node((CrateNum, DefId))
299         -> Rc<Vec<DefId>>,
300     [] fn all_trait_implementations: AllTraitImplementations(CrateNum)
301         -> Rc<Vec<DefId>>,
302
303     [] fn is_dllimport_foreign_item: IsDllimportForeignItem(DefId) -> bool,
304     [] fn is_statically_included_foreign_item: IsStaticallyIncludedForeignItem(DefId) -> bool,
305     [] fn native_library_kind: NativeLibraryKind(DefId)
306         -> Option<NativeLibraryKind>,
307     [] fn link_args: link_args_node(CrateNum) -> Rc<Vec<String>>,
308
309     [] fn named_region_map: NamedRegion(DefIndex) ->
310         Option<Rc<FxHashMap<ItemLocalId, Region>>>,
311     [] fn is_late_bound_map: IsLateBound(DefIndex) ->
312         Option<Rc<FxHashSet<ItemLocalId>>>,
313     [] fn object_lifetime_defaults_map: ObjectLifetimeDefaults(DefIndex)
314         -> Option<Rc<FxHashMap<ItemLocalId, Rc<Vec<ObjectLifetimeDefault>>>>>,
315
316     [] fn visibility: Visibility(DefId) -> ty::Visibility,
317     [] fn dep_kind: DepKind(CrateNum) -> DepKind,
318     [] fn crate_name: CrateName(CrateNum) -> Symbol,
319     [] fn item_children: ItemChildren(DefId) -> Rc<Vec<Export>>,
320     [] fn extern_mod_stmt_cnum: ExternModStmtCnum(DefId) -> Option<CrateNum>,
321
322     [] fn get_lang_items: get_lang_items_node(CrateNum) -> Rc<LanguageItems>,
323     [] fn defined_lang_items: DefinedLangItems(CrateNum) -> Rc<Vec<(DefId, usize)>>,
324     [] fn missing_lang_items: MissingLangItems(CrateNum) -> Rc<Vec<LangItem>>,
325     [] fn extern_const_body: ExternConstBody(DefId) -> ExternConstBody<'tcx>,
326     [] fn visible_parent_map: visible_parent_map_node(CrateNum)
327         -> Rc<DefIdMap<DefId>>,
328     [] fn missing_extern_crate_item: MissingExternCrateItem(CrateNum) -> bool,
329     [] fn used_crate_source: UsedCrateSource(CrateNum) -> Rc<CrateSource>,
330     [] fn postorder_cnums: postorder_cnums_node(CrateNum) -> Rc<Vec<CrateNum>>,
331
332     [] fn freevars: Freevars(DefId) -> Option<Rc<Vec<hir::Freevar>>>,
333     [] fn maybe_unused_trait_import: MaybeUnusedTraitImport(DefId) -> bool,
334     [] fn maybe_unused_extern_crates: maybe_unused_extern_crates_node(CrateNum)
335         -> Rc<Vec<(DefId, Span)>>,
336
337     [] fn stability_index: stability_index_node(CrateNum) -> Rc<stability::Index<'tcx>>,
338     [] fn all_crate_nums: all_crate_nums_node(CrateNum) -> Rc<Vec<CrateNum>>,
339
340     [] fn exported_symbols: ExportedSymbols(CrateNum)
341         -> Arc<Vec<(String, Option<DefId>, SymbolExportLevel)>>,
342     [] fn collect_and_partition_translation_items:
343         collect_and_partition_translation_items_node(CrateNum)
344         -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'tcx>>>>),
345     [] fn export_name: ExportName(DefId) -> Option<Symbol>,
346     [] fn contains_extern_indicator: ContainsExternIndicator(DefId) -> bool,
347     [] fn is_translated_function: IsTranslatedFunction(DefId) -> bool,
348     [] fn codegen_unit: CodegenUnit(InternedString) -> Arc<CodegenUnit<'tcx>>,
349     [] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats,
350     [] fn output_filenames: output_filenames_node(CrateNum)
351         -> Arc<OutputFilenames>,
352
353     [] fn has_copy_closures: HasCopyClosures(CrateNum) -> bool,
354     [] fn has_clone_closures: HasCloneClosures(CrateNum) -> bool,
355
356     // Erases regions from `ty` to yield a new type.
357     // Normally you would just use `tcx.erase_regions(&value)`,
358     // however, which uses this query as a kind of cache.
359     [] fn erase_regions_ty: erase_regions_ty(Ty<'tcx>) -> Ty<'tcx>,
360     [] fn fully_normalize_monormophic_ty: normalize_ty_node(Ty<'tcx>) -> Ty<'tcx>,
361 }
362
363 //////////////////////////////////////////////////////////////////////
364 // These functions are little shims used to find the dep-node for a
365 // given query when there is not a *direct* mapping:
366
367 fn erase_regions_ty<'tcx>(ty: Ty<'tcx>) -> DepConstructor<'tcx> {
368     DepConstructor::EraseRegionsTy { ty }
369 }
370
371 fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {
372     DepConstructor::TypeParamPredicates {
373         item_id,
374         param_id
375     }
376 }
377
378 fn fulfill_obligation_dep_node<'tcx>((param_env, trait_ref):
379     (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> DepConstructor<'tcx> {
380     DepConstructor::FulfillObligation {
381         param_env,
382         trait_ref
383     }
384 }
385
386 fn coherent_trait_dep_node<'tcx>((_, def_id): (CrateNum, DefId)) -> DepConstructor<'tcx> {
387     DepConstructor::CoherenceCheckTrait(def_id)
388 }
389
390 fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
391     DepConstructor::Coherence
392 }
393
394 fn inherent_impls_overlap_check_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
395     DepConstructor::CoherenceInherentImplOverlapCheck
396 }
397
398 fn reachability_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
399     DepConstructor::Reachability
400 }
401
402 fn mir_shim_dep_node<'tcx>(instance_def: ty::InstanceDef<'tcx>) -> DepConstructor<'tcx> {
403     DepConstructor::MirShim {
404         instance_def
405     }
406 }
407
408 fn symbol_name_dep_node<'tcx>(instance: ty::Instance<'tcx>) -> DepConstructor<'tcx> {
409     DepConstructor::InstanceSymbolName { instance }
410 }
411
412 fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
413     DepConstructor::TypeckBodiesKrate
414 }
415
416 fn const_eval_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
417                              -> DepConstructor<'tcx> {
418     DepConstructor::ConstEval { param_env }
419 }
420
421 fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
422     DepConstructor::MirKeys
423 }
424
425 fn crate_variances<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
426     DepConstructor::CrateVariances
427 }
428
429 fn is_copy_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
430     DepConstructor::IsCopy { param_env }
431 }
432
433 fn is_sized_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
434     DepConstructor::IsSized { param_env }
435 }
436
437 fn is_freeze_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
438     DepConstructor::IsFreeze { param_env }
439 }
440
441 fn needs_drop_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
442     DepConstructor::NeedsDrop { param_env }
443 }
444
445 fn layout_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
446     DepConstructor::Layout { param_env }
447 }
448
449 fn lint_levels_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
450     DepConstructor::LintLevels
451 }
452
453 fn specializes_node<'tcx>((a, b): (DefId, DefId)) -> DepConstructor<'tcx> {
454     DepConstructor::Specializes { impl1: a, impl2: b }
455 }
456
457 fn implementations_of_trait_node<'tcx>((krate, trait_id): (CrateNum, DefId))
458     -> DepConstructor<'tcx>
459 {
460     DepConstructor::ImplementationsOfTrait { krate, trait_id }
461 }
462
463 fn link_args_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
464     DepConstructor::LinkArgs
465 }
466
467 fn get_lang_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
468     DepConstructor::GetLangItems
469 }
470
471 fn visible_parent_map_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
472     DepConstructor::VisibleParentMap
473 }
474
475 fn postorder_cnums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
476     DepConstructor::PostorderCnums
477 }
478
479 fn maybe_unused_extern_crates_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
480     DepConstructor::MaybeUnusedExternCrates
481 }
482
483 fn stability_index_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
484     DepConstructor::StabilityIndex
485 }
486
487 fn all_crate_nums_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
488     DepConstructor::AllCrateNums
489 }
490
491 fn collect_and_partition_translation_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
492     DepConstructor::CollectAndPartitionTranslationItems
493 }
494
495 fn output_filenames_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
496     DepConstructor::OutputFilenames
497 }
498
499 fn vtable_methods_node<'tcx>(trait_ref: ty::PolyTraitRef<'tcx>) -> DepConstructor<'tcx> {
500     DepConstructor::VtableMethods{ trait_ref }
501 }
502 fn normalize_ty_node<'tcx>(_: Ty<'tcx>) -> DepConstructor<'tcx> {
503     DepConstructor::NormalizeTy
504 }