Skip to content

Commit 1c18aa3

Browse files
committed
erase_regions to erase_and_anonymize_regions
1 parent 6ba0ce4 commit 1c18aa3

File tree

61 files changed

+158
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+158
-132
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

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

629629
// Type-test failed. Report the error.
630-
let erased_generic_kind = infcx.tcx.erase_regions(type_test.generic_kind);
630+
let erased_generic_kind = infcx.tcx.erase_and_anonymize_regions(type_test.generic_kind);
631631

632632
// Skip duplicate-ish errors.
633633
if deduplicate_errors.insert((

compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ fn compute_concrete_types_from_defining_uses<'tcx>(
344344
//
345345
// FIXME(-Znext-solver): This isn't necessary after all. We can remove this check again.
346346
if let Some((prev_decl_key, prev_span)) = decls_modulo_regions.insert(
347-
rcx.infcx.tcx.erase_regions(opaque_type_key),
347+
rcx.infcx.tcx.erase_and_anonymize_regions(opaque_type_key),
348348
(opaque_type_key, hidden_type.span),
349349
) && let Some((arg1, arg2)) = std::iter::zip(
350350
prev_decl_key.iter_captured_args(infcx.tcx).map(|(_, arg)| arg),

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18751875
if is_diverging {
18761876
// The signature in this call can reference region variables,
18771877
// so erase them before calling a query.
1878-
let output_ty = self.tcx().erase_regions(sig.output());
1878+
let output_ty = self.tcx().erase_and_anonymize_regions(sig.output());
18791879
if !output_ty
18801880
.is_privately_uninhabited(self.tcx(), self.infcx.typing_env(self.infcx.param_env))
18811881
{
@@ -1969,7 +1969,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19691969

19701970
let op_arg_ty = self.normalize(op_arg_ty, term_location);
19711971
let category = if call_source.from_hir_call() {
1972-
ConstraintCategory::CallArgument(Some(self.infcx.tcx.erase_regions(func_ty)))
1972+
ConstraintCategory::CallArgument(Some(
1973+
self.infcx.tcx.erase_and_anonymize_regions(func_ty),
1974+
))
19731975
} else {
19741976
ConstraintCategory::Boring
19751977
};
@@ -2103,7 +2105,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21032105
// Erase the regions from `ty` to get a global type. The
21042106
// `Sized` bound in no way depends on precise regions, so this
21052107
// shouldn't affect `is_sized`.
2106-
let erased_ty = tcx.erase_regions(ty);
2108+
let erased_ty = tcx.erase_and_anonymize_regions(ty);
21072109
// FIXME(#132279): Using `Ty::is_sized` causes us to incorrectly handle opaques here.
21082110
if !erased_ty.is_sized(tcx, self.infcx.typing_env(self.infcx.param_env)) {
21092111
// in current MIR construction, all non-control-flow rvalue

compiler/rustc_codegen_gcc/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
240240

241241
// Make sure lifetimes are erased, to avoid generating distinct LLVM
242242
// types for Rust types that only differ in the choice of lifetimes.
243-
let normal_ty = cx.tcx.erase_regions(self.ty);
243+
let normal_ty = cx.tcx.erase_and_anonymize_regions(self.ty);
244244

245245
let mut defer = None;
246246
let ty = if self.ty != normal_ty {

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
14251425

14261426
let vtable_entries = if let Some(poly_trait_ref) = poly_trait_ref {
14271427
let trait_ref = poly_trait_ref.with_self_ty(tcx, ty);
1428-
let trait_ref = tcx.erase_regions(trait_ref);
1428+
let trait_ref = tcx.erase_and_anonymize_regions(trait_ref);
14291429

14301430
tcx.vtable_entries(trait_ref)
14311431
} else {
@@ -1552,7 +1552,7 @@ pub(crate) fn apply_vcall_visibility_metadata<'ll, 'tcx>(
15521552
// Unwrap potential addrspacecast
15531553
let vtable = find_vtable_behind_cast(vtable);
15541554
let trait_ref_self = trait_ref.with_self_ty(cx.tcx, ty);
1555-
let trait_ref_self = cx.tcx.erase_regions(trait_ref_self);
1555+
let trait_ref_self = cx.tcx.erase_and_anonymize_regions(trait_ref_self);
15561556
let trait_def_id = trait_ref_self.def_id;
15571557
let trait_vis = cx.tcx.visibility(trait_def_id);
15581558

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
226226

227227
// Make sure lifetimes are erased, to avoid generating distinct LLVM
228228
// types for Rust types that only differ in the choice of lifetimes.
229-
let normal_ty = cx.tcx.erase_regions(self.ty);
229+
let normal_ty = cx.tcx.erase_and_anonymize_regions(self.ty);
230230

231231
let mut defer = None;
232232
let llty = if self.ty != normal_ty {

compiler/rustc_const_eval/src/interpret/traits.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
2323
) -> InterpResult<'tcx, Pointer<Option<M::Provenance>>> {
2424
trace!("get_vtable(ty={ty:?}, dyn_ty={dyn_ty:?})");
2525

26-
let (ty, dyn_ty) = self.tcx.erase_regions((ty, dyn_ty));
26+
let (ty, dyn_ty) = self.tcx.erase_and_anonymize_regions((ty, dyn_ty));
2727

2828
// All vtables must be monomorphic, bail out otherwise.
2929
ensure_monomorphic_enough(*self.tcx, ty)?;
@@ -53,8 +53,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
5353
) -> &'tcx [VtblEntry<'tcx>] {
5454
if let Some(trait_) = trait_ {
5555
let trait_ref = trait_.with_self_ty(*self.tcx, dyn_ty);
56-
let trait_ref =
57-
self.tcx.erase_regions(self.tcx.instantiate_bound_regions_with_erased(trait_ref));
56+
let trait_ref = self.tcx.erase_and_anonymize_regions(
57+
self.tcx.instantiate_bound_regions_with_erased(trait_ref),
58+
);
5859
self.tcx.vtable_entries(trait_ref)
5960
} else {
6061
TyCtxt::COMMON_VTABLE_ENTRIES

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ fn check_type_defn<'tcx>(
10471047
let needs_drop_copy = || {
10481048
packed && {
10491049
let ty = tcx.type_of(variant.tail().did).instantiate_identity();
1050-
let ty = tcx.erase_regions(ty);
1050+
let ty = tcx.erase_and_anonymize_regions(ty);
10511051
assert!(!ty.has_infer());
10521052
ty.needs_drop(tcx, wfcx.infcx.typing_env(wfcx.param_env))
10531053
}

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ fn emit_orphan_check_error<'tcx>(
404404
of_trait.trait_ref.path.span
405405
};
406406

407-
ty = tcx.erase_regions(ty);
407+
ty = tcx.erase_and_anonymize_regions(ty);
408408

409409
let is_foreign =
410410
!trait_ref.def_id.is_local() && matches!(is_target_ty, IsFirstInputType::No);

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
482482
.map(|header| header.trait_ref.instantiate_identity().self_ty())
483483
// We don't care about blanket impls.
484484
.filter(|self_ty| !self_ty.has_non_region_param())
485-
.map(|self_ty| tcx.erase_regions(self_ty).to_string())
485+
.map(|self_ty| tcx.erase_and_anonymize_regions(self_ty).to_string())
486486
.collect()
487487
};
488488
// FIXME: also look at `tcx.generics_of(self.item_def_id()).params` any that

0 commit comments

Comments
 (0)