Skip to content

Commit 4df7bff

Browse files
committed
Change FnAbi::fixed_count to a u32.
1 parent e4bf113 commit 4df7bff

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
325325
fn llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
326326
// Ignore "extra" args from the call site for C variadic functions.
327327
// Only the "fixed" args are part of the LLVM function signature.
328-
let args = if self.c_variadic { &self.args[..self.fixed_count] } else { &self.args };
328+
let args =
329+
if self.c_variadic { &self.args[..self.fixed_count as usize] } else { &self.args };
329330

330331
let args_capacity: usize = args.iter().map(|arg|
331332
if arg.pad.is_some() { 1 } else { 0 } +

compiler/rustc_middle/src/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3262,7 +3262,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
32623262
.map(|(i, ty)| arg_of(ty, Some(i)))
32633263
.collect::<Result<_, _>>()?,
32643264
c_variadic: sig.c_variadic,
3265-
fixed_count: inputs.len(),
3265+
fixed_count: inputs.len() as u32,
32663266
conv,
32673267
can_unwind: fn_can_unwind(self.tcx(), fn_def_id, sig.abi),
32683268
};

compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ pub fn typeid_for_fnabi<'tcx>(
888888
typeid.push('v');
889889
}
890890
} else {
891-
for n in 0..fn_abi.fixed_count {
891+
for n in 0..fn_abi.fixed_count as usize {
892892
let ty = transform_ty(tcx, fn_abi.args[n].layout.ty, transform_ty_options);
893893
typeid.push_str(&encode_ty(tcx, ty, &mut dict, encode_ty_options));
894894
}

compiler/rustc_target/src/abi/call/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ pub struct FnAbi<'a, Ty> {
625625
///
626626
/// Should only be different from args.len() when c_variadic is true.
627627
/// This can be used to know whether an argument is variadic or not.
628-
pub fixed_count: usize,
628+
pub fixed_count: u32,
629629

630630
pub conv: Conv,
631631

@@ -738,5 +738,5 @@ mod size_asserts {
738738
use rustc_data_structures::static_assert_size;
739739
// These are in alphabetical order, which is easy to maintain.
740740
static_assert_size!(ArgAbi<'_, usize>, 72);
741-
static_assert_size!(FnAbi<'_, usize>, 112);
741+
static_assert_size!(FnAbi<'_, usize>, 104);
742742
}

compiler/rustc_target/src/abi/call/riscv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ where
340340
arg,
341341
xlen,
342342
flen,
343-
i >= fn_abi.fixed_count,
343+
i >= fn_abi.fixed_count as usize,
344344
&mut avail_gprs,
345345
&mut avail_fprs,
346346
);

0 commit comments

Comments
 (0)