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