Skip to content

Commit e982971

Browse files
committed
replace usages of fn_sig query with bound_fn_sig
1 parent d7948c8 commit e982971

File tree

66 files changed

+147
-113
lines changed

Some content is hidden

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

66 files changed

+147
-113
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
25992599
match ty.kind() {
26002600
ty::FnDef(_, _) | ty::FnPtr(_) => self.annotate_fn_sig(
26012601
self.mir_def_id(),
2602-
self.infcx.tcx.fn_sig(self.mir_def_id()),
2602+
self.infcx.tcx.bound_fn_sig(self.mir_def_id().into()).subst_identity(),
26032603
),
26042604
_ => None,
26052605
}

compiler/rustc_borrowck/src/diagnostics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11361136
&& let self_ty = infcx.replace_bound_vars_with_fresh_vars(
11371137
fn_call_span,
11381138
LateBoundRegionConversionTime::FnCall,
1139-
tcx.fn_sig(method_did).input(0),
1139+
tcx.bound_fn_sig(method_did).subst_identity().input(0),
11401140
)
11411141
&& infcx.can_eq(self.param_env, ty, self_ty).is_ok()
11421142
{

compiler/rustc_borrowck/src/universal_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
472472
// C-variadic fns also have a `VaList` input that's not listed in the signature
473473
// (as it's created inside the body itself, not passed in from outside).
474474
if let DefiningTy::FnDef(def_id, _) = defining_ty {
475-
if self.infcx.tcx.fn_sig(def_id).c_variadic() {
475+
if self.infcx.tcx.bound_fn_sig(def_id).skip_binder().c_variadic() {
476476
let va_list_did = self.infcx.tcx.require_lang_item(
477477
LangItem::VaList,
478478
Some(self.infcx.tcx.def_span(self.mir_def.did)),
@@ -665,7 +665,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
665665
}
666666

667667
DefiningTy::FnDef(def_id, _) => {
668-
let sig = tcx.fn_sig(def_id);
668+
let sig = tcx.bound_fn_sig(def_id).subst_identity();
669669
let sig = indices.fold_to_region_vids(tcx, sig);
670670
sig.inputs_and_output()
671671
}

compiler/rustc_codegen_cranelift/src/main_shim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub(crate) fn maybe_create_entry_wrapper(
4646
is_main_fn: bool,
4747
sigpipe: u8,
4848
) {
49-
let main_ret_ty = tcx.fn_sig(rust_main_def_id).output();
49+
let main_ret_ty = tcx.bound_fn_sig(rust_main_def_id).subst_identity().output();
5050
// Given that `main()` has no arguments,
5151
// then its return type cannot have
5252
// late-bound regions, since late-bound

compiler/rustc_codegen_llvm/src/attributes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
441441
// the WebAssembly specification, which has this feature. This won't be
442442
// needed when LLVM enables this `multivalue` feature by default.
443443
if !cx.tcx.is_closure(instance.def_id()) {
444-
let abi = cx.tcx.fn_sig(instance.def_id()).abi();
444+
let abi = cx.tcx.bound_fn_sig(instance.def_id()).skip_binder().abi();
445445
if abi == Abi::Wasm {
446446
function_features.push("+multivalue".to_string());
447447
}

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
214214
}
215215
} else if attr.has_name(sym::cmse_nonsecure_entry) {
216216
if validate_fn_only_attr(attr.span)
217-
&& !matches!(tcx.fn_sig(did).abi(), abi::Abi::C { .. })
217+
&& !matches!(tcx.bound_fn_sig(did.into()).skip_binder().abi(), abi::Abi::C { .. })
218218
{
219219
struct_span_err!(
220220
tcx.sess,
@@ -234,7 +234,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
234234
} else if attr.has_name(sym::track_caller) {
235235
if !tcx.is_closure(did.to_def_id())
236236
&& validate_fn_only_attr(attr.span)
237-
&& tcx.fn_sig(did).abi() != abi::Abi::Rust
237+
&& tcx.bound_fn_sig(did.into()).skip_binder().abi() != abi::Abi::Rust
238238
{
239239
struct_span_err!(tcx.sess, attr.span, E0737, "`#[track_caller]` requires Rust ABI")
240240
.emit();
@@ -266,7 +266,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
266266
}
267267
} else if attr.has_name(sym::target_feature) {
268268
if !tcx.is_closure(did.to_def_id())
269-
&& tcx.fn_sig(did).unsafety() == hir::Unsafety::Normal
269+
&& tcx.bound_fn_sig(did.into()).skip_binder().unsafety() == hir::Unsafety::Normal
270270
{
271271
if tcx.sess.target.is_like_wasm || tcx.sess.opts.actually_rustdoc {
272272
// The `#[target_feature]` attribute is allowed on

compiler/rustc_const_eval/src/const_eval/fn_queries.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
6464
&& match tcx.lookup_const_stability(def_id) {
6565
Some(stab) => {
6666
if cfg!(debug_assertions) && stab.promotable {
67-
let sig = tcx.fn_sig(def_id);
67+
let sig = tcx.bound_fn_sig(def_id);
6868
assert_eq!(
69-
sig.unsafety(),
69+
sig.skip_binder().unsafety(),
7070
hir::Unsafety::Normal,
7171
"don't mark const unsafe fns as promotable",
7272
// https://github.com/rust-lang/rust/pull/53851#issuecomment-418760682

compiler/rustc_const_eval/src/transform/check_consts/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'mir, 'tcx> ConstCx<'mir, 'tcx> {
7272
let ty::Closure(_, substs) = ty.kind() else { bug!("type_of closure not ty::Closure") };
7373
substs.as_closure().sig()
7474
} else {
75-
self.tcx.fn_sig(did)
75+
self.tcx.bound_fn_sig(did).subst_identity()
7676
}
7777
}
7878
}

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fn compare_method_predicate_entailment<'tcx>(
249249
let unnormalized_impl_sig = infcx.replace_bound_vars_with_fresh_vars(
250250
impl_m_span,
251251
infer::HigherRankedType,
252-
tcx.fn_sig(impl_m.def_id),
252+
tcx.bound_fn_sig(impl_m.def_id).subst_identity(),
253253
);
254254
let unnormalized_impl_fty = tcx.mk_fn_ptr(ty::Binder::dummy(unnormalized_impl_sig));
255255

@@ -422,8 +422,8 @@ fn extract_bad_args_for_implies_lint<'tcx>(
422422

423423
// Map late-bound regions from trait to impl, so the names are right.
424424
let mapping = std::iter::zip(
425-
tcx.fn_sig(trait_m.def_id).bound_vars(),
426-
tcx.fn_sig(impl_m.def_id).bound_vars(),
425+
tcx.bound_fn_sig(trait_m.def_id).subst_identity().bound_vars(),
426+
tcx.bound_fn_sig(impl_m.def_id).subst_identity().bound_vars(),
427427
)
428428
.filter_map(|(impl_bv, trait_bv)| {
429429
if let ty::BoundVariableKind::Region(impl_bv) = impl_bv
@@ -540,7 +540,7 @@ fn compare_asyncness<'tcx>(
540540
trait_item_span: Option<Span>,
541541
) -> Result<(), ErrorGuaranteed> {
542542
if tcx.asyncness(trait_m.def_id) == hir::IsAsync::Async {
543-
match tcx.fn_sig(impl_m.def_id).skip_binder().output().kind() {
543+
match tcx.bound_fn_sig(impl_m.def_id).subst_identity().skip_binder().output().kind() {
544544
ty::Alias(ty::Opaque, ..) => {
545545
// allow both `async fn foo()` and `fn foo() -> impl Future`
546546
}
@@ -643,7 +643,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
643643
infcx.replace_bound_vars_with_fresh_vars(
644644
return_span,
645645
infer::HigherRankedType,
646-
tcx.fn_sig(impl_m.def_id),
646+
tcx.bound_fn_sig(impl_m.def_id).subst_identity(),
647647
),
648648
);
649649
impl_sig.error_reported()?;
@@ -1117,7 +1117,7 @@ fn compare_self_type<'tcx>(
11171117
ty::ImplContainer => impl_trait_ref.self_ty(),
11181118
ty::TraitContainer => tcx.types.self_param,
11191119
};
1120-
let self_arg_ty = tcx.fn_sig(method.def_id).input(0);
1120+
let self_arg_ty = tcx.bound_fn_sig(method.def_id).subst_identity().input(0);
11211121
let param_env = ty::ParamEnv::reveal_all();
11221122

11231123
let infcx = tcx.infer_ctxt().build();
@@ -1348,10 +1348,10 @@ fn compare_number_of_method_arguments<'tcx>(
13481348
trait_m: &ty::AssocItem,
13491349
trait_item_span: Option<Span>,
13501350
) -> Result<(), ErrorGuaranteed> {
1351-
let impl_m_fty = tcx.fn_sig(impl_m.def_id);
1352-
let trait_m_fty = tcx.fn_sig(trait_m.def_id);
1353-
let trait_number_args = trait_m_fty.inputs().skip_binder().len();
1354-
let impl_number_args = impl_m_fty.inputs().skip_binder().len();
1351+
let impl_m_fty = tcx.bound_fn_sig(impl_m.def_id);
1352+
let trait_m_fty = tcx.bound_fn_sig(trait_m.def_id);
1353+
let trait_number_args = trait_m_fty.skip_binder().inputs().skip_binder().len();
1354+
let impl_number_args = impl_m_fty.skip_binder().inputs().skip_binder().len();
13551355

13561356
if trait_number_args != impl_number_args {
13571357
let trait_span = trait_m

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn equate_intrinsic_type<'tcx>(
5858
let fty = tcx.mk_fn_ptr(sig);
5959
let it_def_id = it.owner_id.def_id;
6060
let cause = ObligationCause::new(it.span, it_def_id, ObligationCauseCode::IntrinsicType);
61-
require_same_types(tcx, &cause, tcx.mk_fn_ptr(tcx.fn_sig(it.owner_id)), fty);
61+
require_same_types(tcx, &cause, tcx.mk_fn_ptr(tcx.bound_fn_sig(it.owner_id.to_def_id()).subst_identity()), fty);
6262
}
6363
}
6464

compiler/rustc_hir_analysis/src/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ fn suggestion_signature(assoc: &ty::AssocItem, tcx: TyCtxt<'_>) -> String {
445445
// regions just fine, showing `fn(&MyType)`.
446446
fn_sig_suggestion(
447447
tcx,
448-
tcx.fn_sig(assoc.def_id).skip_binder(),
448+
tcx.bound_fn_sig(assoc.def_id).subst_identity().skip_binder(),
449449
assoc.ident(tcx),
450450
tcx.predicates_of(assoc.def_id),
451451
assoc,

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe
386386
// `Self::Iter<'a>` is a GAT we want to gather any potential missing bounds from.
387387
let sig: ty::FnSig<'_> = tcx.liberate_late_bound_regions(
388388
item_def_id.to_def_id(),
389-
tcx.fn_sig(item_def_id),
389+
tcx.bound_fn_sig(item_def_id.to_def_id()).subst_identity(),
390390
);
391391
gather_gat_bounds(
392392
tcx,
@@ -1018,7 +1018,7 @@ fn check_associated_item(
10181018
wfcx.register_wf_obligation(span, loc, ty.into());
10191019
}
10201020
ty::AssocKind::Fn => {
1021-
let sig = tcx.fn_sig(item.def_id);
1021+
let sig = tcx.bound_fn_sig(item.def_id).subst_identity();
10221022
let hir_sig = sig_if_method.expect("bad signature for method");
10231023
check_fn_or_method(
10241024
wfcx,
@@ -1203,7 +1203,7 @@ fn check_item_fn(
12031203
decl: &hir::FnDecl<'_>,
12041204
) {
12051205
enter_wf_checking_ctxt(tcx, span, def_id, |wfcx| {
1206-
let sig = tcx.fn_sig(def_id);
1206+
let sig = tcx.bound_fn_sig(def_id.into()).subst_identity();
12071207
check_fn_or_method(wfcx, ident.span, sig, decl, def_id);
12081208
})
12091209
}
@@ -1638,7 +1638,7 @@ fn check_method_receiver<'tcx>(
16381638

16391639
let span = fn_sig.decl.inputs[0].span;
16401640

1641-
let sig = tcx.fn_sig(method.def_id);
1641+
let sig = tcx.bound_fn_sig(method.def_id).subst_identity();
16421642
let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
16431643
let sig = wfcx.normalize(span, None, sig);
16441644

compiler/rustc_hir_analysis/src/collect/type_of.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,9 @@ fn infer_placeholder_type<'a>(
867867
}
868868

869869
match ty.kind() {
870-
ty::FnDef(def_id, _) => self.tcx.mk_fn_ptr(self.tcx.fn_sig(*def_id)),
870+
ty::FnDef(def_id, _) => {
871+
self.tcx.mk_fn_ptr(self.tcx.bound_fn_sig(*def_id).subst_identity())
872+
}
871873
// FIXME: non-capturing closures should also suggest a function pointer
872874
ty::Closure(..) | ty::Generator(..) => {
873875
self.success = false;

compiler/rustc_hir_analysis/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn require_same_types<'tcx>(
182182
}
183183

184184
fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
185-
let main_fnsig = tcx.fn_sig(main_def_id);
185+
let main_fnsig = tcx.bound_fn_sig(main_def_id).subst_identity();
186186
let main_span = tcx.def_span(main_def_id);
187187

188188
fn main_fn_diagnostics_def_id(tcx: TyCtxt<'_>, def_id: DefId, sp: Span) -> LocalDefId {
@@ -449,7 +449,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
449449
ObligationCauseCode::StartFunctionType,
450450
),
451451
se_ty,
452-
tcx.mk_fn_ptr(tcx.fn_sig(start_def_id)),
452+
tcx.mk_fn_ptr(tcx.bound_fn_sig(start_def_id.into()).subst_identity()),
453453
);
454454
}
455455
_ => {

compiler/rustc_hir_analysis/src/variance/constraints.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
119119
}
120120

121121
ty::FnDef(..) => {
122-
self.add_constraints_from_sig(current_item, tcx.fn_sig(def_id), self.covariant);
122+
self.add_constraints_from_sig(
123+
current_item,
124+
tcx.bound_fn_sig(def_id.into()).subst_identity(),
125+
self.covariant,
126+
);
123127
}
124128

125129
ty::Error(_) => {}

compiler/rustc_hir_typeck/src/demand.rs

+17-3
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
299299
{
300300
// We special case methods, because they can influence inference through the
301301
// call's arguments and we can provide a more explicit span.
302-
let sig = self.tcx.fn_sig(def_id);
302+
let sig = self.tcx.bound_fn_sig(def_id).subst_identity();
303303
let def_self_ty = sig.input(0).skip_binder();
304304
let rcvr_ty = self.node_ty(rcvr.hir_id);
305305
// Get the evaluated type *after* calling the method call, so that the influence
@@ -611,7 +611,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
611611
with_no_trimmed_paths!(
612612
self.tcx.def_path_str_with_substs(m.def_id, substs,)
613613
),
614-
match self.tcx.fn_sig(m.def_id).input(0).skip_binder().kind() {
614+
match self
615+
.tcx
616+
.bound_fn_sig(m.def_id)
617+
.subst_identity()
618+
.input(0)
619+
.skip_binder()
620+
.kind()
621+
{
615622
ty::Ref(_, _, hir::Mutability::Mut) => "&mut ",
616623
ty::Ref(_, _, _) => "&",
617624
_ => "",
@@ -1036,7 +1043,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10361043
match method.kind {
10371044
ty::AssocKind::Fn => {
10381045
method.fn_has_self_parameter
1039-
&& self.tcx.fn_sig(method.def_id).inputs().skip_binder().len() == 1
1046+
&& self
1047+
.tcx
1048+
.bound_fn_sig(method.def_id)
1049+
.skip_binder()
1050+
.inputs()
1051+
.skip_binder()
1052+
.len()
1053+
== 1
10401054
}
10411055
_ => false,
10421056
}

compiler/rustc_hir_typeck/src/expr.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
542542

543543
if let ty::FnDef(did, ..) = *ty.kind() {
544544
let fn_sig = ty.fn_sig(tcx);
545-
if tcx.fn_sig(did).abi() == RustIntrinsic && tcx.item_name(did) == sym::transmute {
545+
if tcx.bound_fn_sig(did).skip_binder().abi() == RustIntrinsic
546+
&& tcx.item_name(did) == sym::transmute
547+
{
546548
let from = fn_sig.inputs().skip_binder()[0];
547549
let to = fn_sig.output().skip_binder();
548550
// We defer the transmute to the end of typeck, once all inference vars have

compiler/rustc_hir_typeck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn typeck_with_fallback<'tcx>(
207207
let fn_sig = if rustc_hir_analysis::collect::get_infer_ret_ty(&decl.output).is_some() {
208208
fcx.astconv().ty_of_fn(id, header.unsafety, header.abi, decl, None, None)
209209
} else {
210-
tcx.fn_sig(def_id)
210+
tcx.bound_fn_sig(def_id.into()).subst_identity()
211211
};
212212

213213
check_abi(tcx, id, span, fn_sig.abi());

compiler/rustc_hir_typeck/src/method/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
144144
None,
145145
)
146146
.map(|pick| {
147-
let sig = self.tcx.fn_sig(pick.item.def_id);
148-
sig.inputs().skip_binder().len().saturating_sub(1)
147+
let sig = self.tcx.bound_fn_sig(pick.item.def_id);
148+
sig.skip_binder().inputs().skip_binder().len().saturating_sub(1)
149149
})
150150
.unwrap_or(0);
151151

compiler/rustc_hir_typeck/src/method/suggest.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11271127
ty::AssocKind::Const | ty::AssocKind::Type => rcvr_ty,
11281128
ty::AssocKind::Fn => self
11291129
.tcx
1130-
.fn_sig(item.def_id)
1130+
.bound_fn_sig(item.def_id)
1131+
.subst_identity()
11311132
.inputs()
11321133
.skip_binder()
11331134
.get(0)
@@ -1264,7 +1265,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12641265
&& let Some(assoc) = self.associated_value(*impl_did, item_name)
12651266
&& assoc.kind == ty::AssocKind::Fn
12661267
{
1267-
let sig = self.tcx.fn_sig(assoc.def_id);
1268+
let sig = self.tcx.bound_fn_sig(assoc.def_id).subst_identity();
12681269
sig.inputs().skip_binder().get(0).and_then(|first| if first.peel_refs() == rcvr_ty.peel_refs() {
12691270
None
12701271
} else {
@@ -2098,7 +2099,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20982099
// just changing the path.
20992100
&& pick.item.fn_has_self_parameter
21002101
&& let Some(self_ty) =
2101-
self.tcx.fn_sig(pick.item.def_id).inputs().skip_binder().get(0)
2102+
self.tcx.bound_fn_sig(pick.item.def_id).subst_identity().inputs().skip_binder().get(0)
21022103
&& self_ty.is_ref()
21032104
{
21042105
let suggested_path = match deref_ty.kind() {
@@ -2351,7 +2352,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
23512352
// implement the `AsRef` trait.
23522353
let skip = skippable.contains(&did)
23532354
|| (("Pin::new" == *pre) && (sym::as_ref == item_name.name))
2354-
|| inputs_len.map_or(false, |inputs_len| pick.item.kind == ty::AssocKind::Fn && self.tcx.fn_sig(pick.item.def_id).skip_binder().inputs().len() != inputs_len);
2355+
|| inputs_len.map_or(false, |inputs_len| pick.item.kind == ty::AssocKind::Fn && self.tcx.bound_fn_sig(pick.item.def_id).skip_binder().skip_binder().inputs().len() != inputs_len);
23552356
// Make sure the method is defined for the *actual* receiver: we don't
23562357
// want to treat `Box<Self>` as a receiver if it only works because of
23572358
// an autoderef to `&self`
@@ -2730,8 +2731,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
27302731

27312732
// check the method arguments number
27322733
if let Ok(pick) = probe &&
2733-
let fn_sig = self.tcx.fn_sig(pick.item.def_id) &&
2734-
let fn_args = fn_sig.skip_binder().inputs() &&
2734+
let fn_sig = self.tcx.bound_fn_sig(pick.item.def_id) &&
2735+
let fn_args = fn_sig.skip_binder().skip_binder().inputs() &&
27352736
fn_args.len() == args.len() + 1 {
27362737
err.span_suggestion_verbose(
27372738
method_name.span.shrink_to_hi(),

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn find_param_with_region<'tcx>(
6565

6666
let owner_id = hir.body_owner(body_id);
6767
let fn_decl = hir.fn_decl_by_hir_id(owner_id).unwrap();
68-
let poly_fn_sig = tcx.fn_sig(id);
68+
let poly_fn_sig = tcx.bound_fn_sig(id).subst_identity();
6969

7070
let fn_sig = tcx.liberate_late_bound_regions(id, poly_fn_sig);
7171
let body = hir.body(body_id);

compiler/rustc_lint/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
12251225

12261226
fn check_foreign_fn(&mut self, id: hir::HirId, decl: &hir::FnDecl<'_>) {
12271227
let def_id = self.cx.tcx.hir().local_def_id(id);
1228-
let sig = self.cx.tcx.fn_sig(def_id);
1228+
let sig = self.cx.tcx.bound_fn_sig(def_id.into()).subst_identity();
12291229
let sig = self.cx.tcx.erase_late_bound_regions(sig);
12301230

12311231
for (input_ty, input_hir) in iter::zip(sig.inputs(), decl.inputs) {

0 commit comments

Comments
 (0)