}
Other {
- // Represents crate as a whole (as distinct from the top-level crate module).
- // If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
- // we will have to assume that any change means that you need to be recompiled.
- // This is because the `hir_crate` query gives you access to all other items.
- // To avoid this fate, do not call `tcx.hir().krate()`; instead,
- // prefer wrappers like `tcx.visit_all_items_in_krate()`.
+ /// Represents crate as a whole (as distinct from the top-level crate module).
+ /// If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
+ /// we will have to assume that any change means that you need to be recompiled.
+ /// This is because the `hir_crate` query gives you access to all other items.
+ /// To avoid this fate, do not call `tcx.hir().krate()`; instead,
+ /// prefer wrappers like `tcx.visit_all_items_in_krate()`.
query hir_crate(key: CrateNum) -> &'tcx Crate<'tcx> {
eval_always
no_hash
desc { "get the crate HIR" }
}
- // The indexed HIR. This can be conveniently accessed by `tcx.hir()`.
- // Avoid calling this query directly.
+ /// The indexed HIR. This can be conveniently accessed by `tcx.hir()`.
+ /// Avoid calling this query directly.
query index_hir(_: CrateNum) -> &'tcx map::IndexedHir<'tcx> {
eval_always
no_hash
desc { "index HIR" }
}
- // The items in a module.
- //
- // This can be conveniently accessed by `tcx.hir().visit_item_likes_in_module`.
- // Avoid calling this query directly.
+ /// The items in a module.
+ ///
+ /// This can be conveniently accessed by `tcx.hir().visit_item_likes_in_module`.
+ /// Avoid calling this query directly.
query hir_module_items(key: LocalDefId) -> &'tcx hir::ModuleItems {
eval_always
desc { |tcx| "HIR module items in `{}`", tcx.def_path_str(key.to_def_id()) }
}
- // Gives access to the HIR node for the HIR owner `key`.
- //
- // This can be conveniently accessed by methods on `tcx.hir()`.
- // Avoid calling this query directly.
+ /// Gives access to the HIR node for the HIR owner `key`.
+ ///
+ /// This can be conveniently accessed by methods on `tcx.hir()`.
+ /// Avoid calling this query directly.
query hir_owner(key: LocalDefId) -> Option<&'tcx crate::hir::Owner<'tcx>> {
eval_always
desc { |tcx| "HIR owner of `{}`", tcx.def_path_str(key.to_def_id()) }
}
- // Gives access to the HIR nodes and bodies inside the HIR owner `key`.
- //
- // This can be conveniently accessed by methods on `tcx.hir()`.
- // Avoid calling this query directly.
+ /// Gives access to the HIR nodes and bodies inside the HIR owner `key`.
+ ///
+ /// This can be conveniently accessed by methods on `tcx.hir()`.
+ /// Avoid calling this query directly.
query hir_owner_nodes(key: LocalDefId) -> Option<&'tcx crate::hir::OwnerNodes<'tcx>> {
eval_always
desc { |tcx| "HIR owner items in `{}`", tcx.def_path_str(key.to_def_id()) }
/// Try to build an abstract representation of the given constant.
query mir_abstract_const(
key: DefId
- ) -> Option<&'tcx [mir::abstract_const::Node<'tcx>]> {
+ ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
desc {
|tcx| "building an abstract representation for {}", tcx.def_path_str(key),
}
/// Try to build an abstract representation of the given constant.
query mir_abstract_const_of_const_arg(
key: (LocalDefId, DefId)
- ) -> Option<&'tcx [mir::abstract_const::Node<'tcx>]> {
+ ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
desc {
|tcx|
"building an abstract representation for the const argument {}",
}
TypeChecking {
- // Erases regions from `ty` to yield a new type.
- // Normally you would just use `tcx.erase_regions(&value)`,
- // however, which uses this query as a kind of cache.
+ /// Erases regions from `ty` to yield a new type.
+ /// Normally you would just use `tcx.erase_regions(&value)`,
+ /// however, which uses this query as a kind of cache.
query erase_regions_ty(ty: Ty<'tcx>) -> Ty<'tcx> {
// This query is not expected to have input -- as a result, it
// is not a good candidates for "replay" because it is essentially a
desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
}
- query const_fn_is_allowed_fn_ptr(key: DefId) -> bool {
- desc { |tcx| "checking if const fn allows `fn()` types: `{}`", tcx.def_path_str(key) }
- }
-
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
query is_foreign_item(key: DefId) -> bool {
desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) }
"const-evaluating + checking `{}`",
key.value.display(tcx)
}
+ cache_on_disk_if { true }
}
/// Evaluates const items or anonymous constants
"simplifying constant for the type system `{}`",
key.value.display(tcx)
}
- cache_on_disk_if(_, opt_result) {
- // Only store results without errors
- opt_result.map_or(true, |r| r.is_ok())
- }
+ cache_on_disk_if { true }
}
/// Destructure a constant ADT or array into its variant index and its
desc { "destructure constant" }
}
+ /// Dereference a constant reference or raw pointer and turn the result into a constant
+ /// again.
+ query deref_const(
+ key: ty::ParamEnvAnd<'tcx, &'tcx ty::Const<'tcx>>
+ ) -> &'tcx ty::Const<'tcx> {
+ desc { "deref constant" }
+ }
+
query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> ConstValue<'tcx> {
desc { "get a &core::panic::Location referring to a span" }
}
desc { "looking up supported target features" }
}
- // Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
+ /// Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
query instance_def_size_estimate(def: ty::InstanceDef<'tcx>)
-> usize {
desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }