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