refactor(rustc_middle): Substs -> GenericArg
This commit is contained in:
parent
df5c2cf9bc
commit
e55583c4b8
466 changed files with 4574 additions and 4604 deletions
|
@ -6,8 +6,8 @@ use crate::mir::interpret::ConstValue;
|
|||
use crate::traits;
|
||||
use crate::ty::fast_reject::SimplifiedType;
|
||||
use crate::ty::layout::{TyAndLayout, ValidityRequirement};
|
||||
use crate::ty::subst::{GenericArg, SubstsRef};
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
use crate::ty::{GenericArg, GenericArgsRef};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
|
||||
use rustc_hir::hir_id::{HirId, OwnerId};
|
||||
use rustc_query_system::query::{DefaultCacheSelector, SingleCacheSelector, VecCacheSelector};
|
||||
|
@ -286,7 +286,7 @@ impl Key for (DefId, SimplifiedType) {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for SubstsRef<'tcx> {
|
||||
impl<'tcx> Key for GenericArgsRef<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
|
@ -294,7 +294,7 @@ impl<'tcx> Key for SubstsRef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (DefId, SubstsRef<'tcx>) {
|
||||
impl<'tcx> Key for (DefId, GenericArgsRef<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
|
@ -310,7 +310,7 @@ impl<'tcx> Key for (ty::UnevaluatedConst<'tcx>, ty::UnevaluatedConst<'tcx>) {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) {
|
||||
impl<'tcx> Key for (LocalDefId, DefId, GenericArgsRef<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
|
@ -487,7 +487,7 @@ impl Key for (Symbol, u32, u32) {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ty::ParamEnv<'tcx>) {
|
||||
impl<'tcx> Key for (DefId, Ty<'tcx>, GenericArgsRef<'tcx>, ty::ParamEnv<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
|
|
|
@ -44,7 +44,6 @@ use crate::traits::{
|
|||
};
|
||||
use crate::ty::fast_reject::SimplifiedType;
|
||||
use crate::ty::layout::ValidityRequirement;
|
||||
use crate::ty::subst::{GenericArg, SubstsRef};
|
||||
use crate::ty::util::AlwaysRequiresDrop;
|
||||
use crate::ty::GeneratorDiagnosticData;
|
||||
use crate::ty::TyCtxtFeed;
|
||||
|
@ -52,6 +51,7 @@ use crate::ty::{
|
|||
self, print::describe_as_module, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt,
|
||||
UnusedGenericParams,
|
||||
};
|
||||
use crate::ty::{GenericArg, GenericArgsRef};
|
||||
use rustc_arena::TypedArena;
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::expand::{allocator::AllocatorKind, StrippedCfgItem};
|
||||
|
@ -1032,7 +1032,7 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
/// Obtain all the calls into other local functions
|
||||
query mir_inliner_callees(key: ty::InstanceDef<'tcx>) -> &'tcx [(DefId, SubstsRef<'tcx>)] {
|
||||
query mir_inliner_callees(key: ty::InstanceDef<'tcx>) -> &'tcx [(DefId, GenericArgsRef<'tcx>)] {
|
||||
fatal_cycle
|
||||
desc { |tcx|
|
||||
"computing all local function calls in `{}`",
|
||||
|
@ -1537,7 +1537,7 @@ rustc_queries! {
|
|||
/// added or removed in any upstream crate. Instead use the narrower
|
||||
/// `upstream_monomorphizations_for`, `upstream_drop_glue_for`, or, even
|
||||
/// better, `Instance::upstream_monomorphization()`.
|
||||
query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>> {
|
||||
query upstream_monomorphizations(_: ()) -> &'tcx DefIdMap<FxHashMap<GenericArgsRef<'tcx>, CrateNum>> {
|
||||
arena_cache
|
||||
desc { "collecting available upstream monomorphizations" }
|
||||
}
|
||||
|
@ -1550,7 +1550,7 @@ rustc_queries! {
|
|||
/// You likely want to call `Instance::upstream_monomorphization()`
|
||||
/// instead of invoking this query directly.
|
||||
query upstream_monomorphizations_for(def_id: DefId)
|
||||
-> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>>
|
||||
-> Option<&'tcx FxHashMap<GenericArgsRef<'tcx>, CrateNum>>
|
||||
{
|
||||
desc { |tcx|
|
||||
"collecting available upstream monomorphizations for `{}`",
|
||||
|
@ -1560,7 +1560,7 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
/// Returns the upstream crate that exports drop-glue for the given
|
||||
/// type (`substs` is expected to be a single-item list containing the
|
||||
/// type (`args` is expected to be a single-item list containing the
|
||||
/// type one wants drop-glue for).
|
||||
///
|
||||
/// This is a subset of `upstream_monomorphizations_for` in order to
|
||||
|
@ -1574,8 +1574,8 @@ rustc_queries! {
|
|||
/// NOTE: This query could easily be extended to also support other
|
||||
/// common functions that have are large set of monomorphizations
|
||||
/// (like `Clone::clone` for example).
|
||||
query upstream_drop_glue_for(substs: SubstsRef<'tcx>) -> Option<CrateNum> {
|
||||
desc { "available upstream drop-glue for `{:?}`", substs }
|
||||
query upstream_drop_glue_for(args: GenericArgsRef<'tcx>) -> Option<CrateNum> {
|
||||
desc { "available upstream drop-glue for `{:?}`", args }
|
||||
}
|
||||
|
||||
/// Returns a list of all `extern` blocks of a crate.
|
||||
|
@ -2053,7 +2053,7 @@ rustc_queries! {
|
|||
desc { "normalizing `{:?}`", goal.value.value.value }
|
||||
}
|
||||
|
||||
query subst_and_check_impossible_predicates(key: (DefId, SubstsRef<'tcx>)) -> bool {
|
||||
query subst_and_check_impossible_predicates(key: (DefId, GenericArgsRef<'tcx>)) -> bool {
|
||||
desc { |tcx|
|
||||
"checking impossible substituted predicates: `{}`",
|
||||
tcx.def_path_str(key.0)
|
||||
|
@ -2104,16 +2104,16 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
/// Attempt to resolve the given `DefId` to an `Instance`, for the
|
||||
/// given generics args (`SubstsRef`), returning one of:
|
||||
/// given generics args (`GenericArgsRef`), returning one of:
|
||||
/// * `Ok(Some(instance))` on success
|
||||
/// * `Ok(None)` when the `SubstsRef` are still too generic,
|
||||
/// * `Ok(None)` when the `GenericArgsRef` are still too generic,
|
||||
/// and therefore don't allow finding the final `Instance`
|
||||
/// * `Err(ErrorGuaranteed)` when the `Instance` resolution process
|
||||
/// couldn't complete due to errors elsewhere - this is distinct
|
||||
/// from `Ok(None)` to avoid misleading diagnostics when an error
|
||||
/// has already been/will be emitted, for the original cause
|
||||
query resolve_instance(
|
||||
key: ty::ParamEnvAnd<'tcx, (DefId, SubstsRef<'tcx>)>
|
||||
key: ty::ParamEnvAnd<'tcx, (DefId, GenericArgsRef<'tcx>)>
|
||||
) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
|
||||
desc { "resolving instance `{}`", ty::Instance::new(key.value.0, key.value.1) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue