Skip to content

Commit 5ae769f

Browse files
committed
Auto merge of #116144 - lcnr:subst-less, r=oli-obk
subst -> instantiate continues #110793, there are still quite a few uses of `subst` and `substitute`, but changing them all in the same PR was a bit too much, so I've stopped here for now.
2 parents 5899a80 + 3c52a3e commit 5ae769f

File tree

25 files changed

+66
-75
lines changed

25 files changed

+66
-75
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16641664
lifetime.ident,
16651665
));
16661666

1667-
// Now make an arg that we can use for the substs of the opaque tykind.
1667+
// Now make an arg that we can use for the generic params of the opaque tykind.
16681668
let id = self.next_node_id();
16691669
let lifetime_arg = self.new_named_lifetime_with_res(id, lifetime.ident, res);
16701670
let duplicated_lifetime_def_id = self.local_def_id(duplicated_lifetime_node_id);

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(crate) struct RegionName {
2727
/// This helps to print the right kinds of diagnostics.
2828
#[derive(Debug, Clone)]
2929
pub(crate) enum RegionNameSource {
30-
/// A bound (not free) region that was substituted at the def site (not an HRTB).
30+
/// A bound (not free) region that was instantiated at the def site (not an HRTB).
3131
NamedEarlyBoundRegion(Span),
3232
/// A free region that the user has a name (`'a`) for.
3333
NamedFreeRegion(Span),
@@ -619,7 +619,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
619619
// programs, so we need to use delay_span_bug here. See #82126.
620620
self.infcx.tcx.sess.delay_span_bug(
621621
hir_arg.span(),
622-
format!("unmatched subst and hir arg: found {kind:?} vs {hir_arg:?}"),
622+
format!("unmatched arg and hir arg: found {kind:?} vs {hir_arg:?}"),
623623
);
624624
}
625625
}

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
22502250

22512251
pub(crate) fn universe_info(&self, universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
22522252
// Query canonicalization can create local superuniverses (for example in
2253-
// `InferCtx::query_response_substitution_guess`), but they don't have an associated
2253+
// `InferCtx::query_response_instantiation_guess`), but they don't have an associated
22542254
// `UniverseInfo` explaining why they were created.
22552255
// This can cause ICEs if these causes are accessed in diagnostics, for example in issue
22562256
// #114907 where this happens via liveness and dropck outlives results.

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
10071007
}
10081008

10091009
pub(super) fn register_predefined_opaques_in_new_solver(&mut self) {
1010-
// OK to use the identity substitutions for each opaque type key, since
1010+
// OK to use the identity arguments for each opaque type key, since
10111011
// we remap opaques from HIR typeck back to their definition params.
10121012
let opaques: Vec<_> = self
10131013
.infcx

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,9 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
639639
};
640640

641641
let global_mapping = iter::once((tcx.lifetimes.re_static, fr_static));
642-
let subst_mapping =
643-
iter::zip(identity_args.regions(), fr_args.regions().map(|r| r.as_var()));
642+
let arg_mapping = iter::zip(identity_args.regions(), fr_args.regions().map(|r| r.as_var()));
644643

645-
UniversalRegionIndices { indices: global_mapping.chain(subst_mapping).collect(), fr_static }
644+
UniversalRegionIndices { indices: global_mapping.chain(arg_mapping).collect(), fr_static }
646645
}
647646

648647
fn compute_inputs_and_output(

compiler/rustc_codegen_cranelift/scripts/filter_profile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
100100
stack = &stack[..index + ENCODE_METADATA.len()];
101101
}
102102

103-
const SUBST_AND_NORMALIZE_ERASING_REGIONS: &str = "rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions";
104-
if let Some(index) = stack.find(SUBST_AND_NORMALIZE_ERASING_REGIONS) {
105-
stack = &stack[..index + SUBST_AND_NORMALIZE_ERASING_REGIONS.len()];
103+
const INSTANTIATE_AND_NORMALIZE_ERASING_REGIONS: &str = "rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::instantiate_and_normalize_erasing_regions";
104+
if let Some(index) = stack.find(INSTANTIATE_AND_NORMALIZE_ERASING_REGIONS) {
105+
stack = &stack[..index + INSTANTIATE_AND_NORMALIZE_ERASING_REGIONS.len()];
106106
}
107107

108108
const NORMALIZE_ERASING_LATE_BOUND_REGIONS: &str = "rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::normalize_erasing_late_bound_regions";

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
359359
where
360360
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
361361
{
362-
self.instance.subst_mir_and_normalize_erasing_regions(
362+
self.instance.instantiate_mir_and_normalize_erasing_regions(
363363
self.tcx,
364364
ty::ParamEnv::reveal_all(),
365365
ty::EarlyBinder::bind(value),

compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn make_mir_scope<'ll, 'tcx>(
9090
Some((callee, _)) => {
9191
// FIXME(eddyb) this would be `self.monomorphize(&callee)`
9292
// if this is moved to `rustc_codegen_ssa::mir::debuginfo`.
93-
let callee = cx.tcx.subst_and_normalize_erasing_regions(
93+
let callee = cx.tcx.instantiate_and_normalize_erasing_regions(
9494
instance.args,
9595
ty::ParamEnv::reveal_all(),
9696
ty::EarlyBinder::bind(callee),

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
529529
if let Some(impl_def_id) = cx.tcx.impl_of_method(instance.def_id()) {
530530
// If the method does *not* belong to a trait, proceed
531531
if cx.tcx.trait_id_of_impl(impl_def_id).is_none() {
532-
let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions(
532+
let impl_self_ty = cx.tcx.instantiate_and_normalize_erasing_regions(
533533
instance.args,
534534
ty::ParamEnv::reveal_all(),
535535
cx.tcx.type_of(impl_def_id),

compiler/rustc_codegen_ssa/src/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
118118
T: Copy + TypeFoldable<TyCtxt<'tcx>>,
119119
{
120120
debug!("monomorphize: self.instance={:?}", self.instance);
121-
self.instance.subst_mir_and_normalize_erasing_regions(
121+
self.instance.instantiate_mir_and_normalize_erasing_regions(
122122
self.cx.tcx(),
123123
ty::ParamEnv::reveal_all(),
124124
ty::EarlyBinder::bind(value),

0 commit comments

Comments
 (0)