Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8c6c542

Browse files
committed
rename bound region instantiation
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased` - `replace_late_bound_regions_X` -> `instantiate_bound_regions_X`
1 parent aec4e81 commit 8c6c542

15 files changed

+22
-22
lines changed

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ impl TyCoercionStability {
771771
DefinedTy::Mir(ty) => Self::for_mir_ty(
772772
cx.tcx,
773773
ty.param_env,
774-
cx.tcx.erase_late_bound_regions(ty.value),
774+
cx.tcx.instantiate_bound_regions_with_erased(ty.value),
775775
for_return,
776776
),
777777
}

clippy_lints/src/functions/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn result_err_ty<'tcx>(
2323
&& let hir::FnRetTy::Return(hir_ty) = decl.output
2424
&& let ty = cx
2525
.tcx
26-
.erase_late_bound_regions(cx.tcx.fn_sig(id).instantiate_identity().output())
26+
.instantiate_bound_regions_with_erased(cx.tcx.fn_sig(id).instantiate_identity().output())
2727
&& is_type_diagnostic_item(cx, ty, sym::Result)
2828
&& let ty::Adt(_, args) = ty.kind()
2929
{

clippy_lints/src/iter_not_returning_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn check_sig(cx: &LateContext<'_>, name: &str, sig: &FnSig<'_>, fn_id: LocalDefI
7171
if sig.decl.implicit_self.has_implicit_self() {
7272
let ret_ty = cx
7373
.tcx
74-
.erase_late_bound_regions(cx.tcx.fn_sig(fn_id).instantiate_identity().output());
74+
.instantiate_bound_regions_with_erased(cx.tcx.fn_sig(fn_id).instantiate_identity().output());
7575
let ret_ty = cx
7676
.tcx
7777
.try_normalize_erasing_regions(cx.param_env, ret_ty)

clippy_lints/src/methods/map_flatten.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn is_map_to_option(cx: &LateContext<'_>, map_arg: &Expr<'_>) -> bool {
6363
ty::Closure(_, args) => args.as_closure().sig(),
6464
_ => map_closure_ty.fn_sig(cx.tcx),
6565
};
66-
let map_closure_return_ty = cx.tcx.erase_late_bound_regions(map_closure_sig.output());
66+
let map_closure_return_ty = cx.tcx.instantiate_bound_regions_with_erased(map_closure_sig.output());
6767
is_type_diagnostic_item(cx, map_closure_return_ty, sym::Option)
6868
},
6969
_ => false,

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3897,7 +3897,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
38973897
let implements_trait = matches!(item.kind, hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }));
38983898
if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind {
38993899
let method_sig = cx.tcx.fn_sig(impl_item.owner_id).instantiate_identity();
3900-
let method_sig = cx.tcx.erase_late_bound_regions(method_sig);
3900+
let method_sig = cx.tcx.instantiate_bound_regions_with_erased(method_sig);
39013901
let first_arg_ty_opt = method_sig.inputs().iter().next().copied();
39023902
// if this impl block implements a trait, lint in trait definition instead
39033903
if !implements_trait && cx.effective_visibilities.is_exported(impl_item.owner_id.def_id) {

clippy_lints/src/methods/needless_collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn is_contains_sig(cx: &LateContext<'_>, call_id: HirId, iter_expr: &Expr<'_>) -
225225
&& let sig = cx.tcx.fn_sig(id).instantiate_identity()
226226
&& sig.skip_binder().output().is_bool()
227227
&& let [_, search_ty] = *sig.skip_binder().inputs()
228-
&& let ty::Ref(_, search_ty, Mutability::Not) = *cx.tcx.erase_late_bound_regions(sig.rebind(search_ty)).kind()
228+
&& let ty::Ref(_, search_ty, Mutability::Not) = *cx.tcx.instantiate_bound_regions_with_erased(sig.rebind(search_ty)).kind()
229229
&& let Some(iter_trait) = cx.tcx.get_diagnostic_item(sym::Iterator)
230230
&& let Some(iter_item) = cx.tcx.associated_items(iter_trait).find_by_name_and_kind(
231231
cx.tcx,

clippy_lints/src/mixed_read_write_in_expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
165165
match typ.kind() {
166166
ty::FnDef(..) | ty::FnPtr(_) => {
167167
let sig = typ.fn_sig(self.cx.tcx);
168-
if self.cx.tcx.erase_late_bound_regions(sig).output().kind() == &ty::Never {
168+
if self.cx.tcx.instantiate_bound_regions_with_erased(sig).output().kind() == &ty::Never {
169169
self.report_diverging_sub_expr(e);
170170
}
171171
},

clippy_lints/src/mut_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl MutableKeyType {
143143
for (hir_ty, ty) in iter::zip(decl.inputs, fn_sig.inputs().skip_binder()) {
144144
self.check_ty_(cx, hir_ty.span, *ty);
145145
}
146-
self.check_ty_(cx, decl.output.span(), cx.tcx.erase_late_bound_regions(fn_sig.output()));
146+
self.check_ty_(cx, decl.output.span(), cx.tcx.instantiate_bound_regions_with_erased(fn_sig.output()));
147147
}
148148

149149
// We want to lint 1. sets or maps with 2. not immutable key types and 3. no unerased

clippy_lints/src/pass_by_ref_or_value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<'tcx> PassByRefOrValue {
177177
_ => (),
178178
}
179179

180-
let ty = cx.tcx.erase_late_bound_regions(fn_sig.rebind(ty));
180+
let ty = cx.tcx.instantiate_bound_regions_with_erased(fn_sig.rebind(ty));
181181
if is_copy(cx, ty)
182182
&& let Some(size) = cx.layout_of(ty).ok().map(|l| l.size.bytes())
183183
&& size <= self.ref_min_size
@@ -225,7 +225,7 @@ impl<'tcx> PassByRefOrValue {
225225
_ => continue,
226226
}
227227
}
228-
let ty = cx.tcx.erase_late_bound_regions(ty);
228+
let ty = cx.tcx.instantiate_bound_regions_with_erased(ty);
229229

230230
if is_copy(cx, ty)
231231
&& !is_self_ty(input)

clippy_lints/src/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ fn matches_preds<'tcx>(
712712
preds: &'tcx [ty::PolyExistentialPredicate<'tcx>],
713713
) -> bool {
714714
let infcx = cx.tcx.infer_ctxt().build();
715-
preds.iter().all(|&p| match cx.tcx.erase_late_bound_regions(p) {
715+
preds.iter().all(|&p| match cx.tcx.instantiate_bound_regions_with_erased(p) {
716716
ExistentialPredicate::Trait(p) => infcx
717717
.type_implements_trait(p.def_id, [ty.into()].into_iter().chain(p.args.iter()), cx.param_env)
718718
.must_apply_modulo_regions(),

0 commit comments

Comments
 (0)