From e186cc6df8e22341036560f79cb99691bb54b483 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 9 Sep 2024 11:09:22 +0200 Subject: [PATCH] do `PolyFnSig` -> `FnSig` conversion later --- .../rustc_hir_analysis/src/hir_ty_lowering/cmse.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs index dd519fb92d951..5150db7f51b19 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs @@ -18,9 +18,6 @@ pub(crate) fn validate_cmse_abi<'tcx>( abi: abi::Abi, fn_sig: ty::PolyFnSig<'tcx>, ) { - // this type is only used for layout computation, which does not rely on regions - let fn_sig = tcx.instantiate_bound_regions_with_erased(fn_sig); - if let abi::Abi::CCmseNonSecureCall = abi { let hir_node = tcx.hir_node(hir_id); let hir::Node::Ty(hir::Ty { @@ -70,11 +67,14 @@ pub(crate) fn validate_cmse_abi<'tcx>( /// Returns whether the inputs will fit into the available registers fn is_valid_cmse_inputs<'tcx>( tcx: TyCtxt<'tcx>, - fn_sig: ty::FnSig<'tcx>, + fn_sig: ty::PolyFnSig<'tcx>, ) -> Result, &'tcx LayoutError<'tcx>> { let mut span = None; let mut accum = 0u64; + // this type is only used for layout computation, which does not rely on regions + let fn_sig = tcx.instantiate_bound_regions_with_erased(fn_sig); + for (index, ty) in fn_sig.inputs().iter().enumerate() { let layout = tcx.layout_of(ParamEnv::reveal_all().and(*ty))?; @@ -99,8 +99,11 @@ fn is_valid_cmse_inputs<'tcx>( /// Returns whether the output will fit into the available registers fn is_valid_cmse_output<'tcx>( tcx: TyCtxt<'tcx>, - fn_sig: ty::FnSig<'tcx>, + fn_sig: ty::PolyFnSig<'tcx>, ) -> Result> { + // this type is only used for layout computation, which does not rely on regions + let fn_sig = tcx.instantiate_bound_regions_with_erased(fn_sig); + let mut ret_ty = fn_sig.output(); let layout = tcx.layout_of(ParamEnv::reveal_all().and(ret_ty))?; let size = layout.layout.size().bytes();