Skip to content

Commit e186cc6

Browse files
committed
do PolyFnSig -> FnSig conversion later
1 parent 46115fd commit e186cc6

File tree

1 file changed

+8
-5
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+8
-5
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ pub(crate) fn validate_cmse_abi<'tcx>(
1818
abi: abi::Abi,
1919
fn_sig: ty::PolyFnSig<'tcx>,
2020
) {
21-
// this type is only used for layout computation, which does not rely on regions
22-
let fn_sig = tcx.instantiate_bound_regions_with_erased(fn_sig);
23-
2421
if let abi::Abi::CCmseNonSecureCall = abi {
2522
let hir_node = tcx.hir_node(hir_id);
2623
let hir::Node::Ty(hir::Ty {
@@ -70,11 +67,14 @@ pub(crate) fn validate_cmse_abi<'tcx>(
7067
/// Returns whether the inputs will fit into the available registers
7168
fn is_valid_cmse_inputs<'tcx>(
7269
tcx: TyCtxt<'tcx>,
73-
fn_sig: ty::FnSig<'tcx>,
70+
fn_sig: ty::PolyFnSig<'tcx>,
7471
) -> Result<Result<(), usize>, &'tcx LayoutError<'tcx>> {
7572
let mut span = None;
7673
let mut accum = 0u64;
7774

75+
// this type is only used for layout computation, which does not rely on regions
76+
let fn_sig = tcx.instantiate_bound_regions_with_erased(fn_sig);
77+
7878
for (index, ty) in fn_sig.inputs().iter().enumerate() {
7979
let layout = tcx.layout_of(ParamEnv::reveal_all().and(*ty))?;
8080

@@ -99,8 +99,11 @@ fn is_valid_cmse_inputs<'tcx>(
9999
/// Returns whether the output will fit into the available registers
100100
fn is_valid_cmse_output<'tcx>(
101101
tcx: TyCtxt<'tcx>,
102-
fn_sig: ty::FnSig<'tcx>,
102+
fn_sig: ty::PolyFnSig<'tcx>,
103103
) -> Result<bool, &'tcx LayoutError<'tcx>> {
104+
// this type is only used for layout computation, which does not rely on regions
105+
let fn_sig = tcx.instantiate_bound_regions_with_erased(fn_sig);
106+
104107
let mut ret_ty = fn_sig.output();
105108
let layout = tcx.layout_of(ParamEnv::reveal_all().and(ret_ty))?;
106109
let size = layout.layout.size().bytes();

0 commit comments

Comments
 (0)