Skip to content

Commit c1837ef

Browse files
committed
Querify fn_abi_of_{fn_ptr,instance}.
1 parent e9b6830 commit c1837ef

File tree

19 files changed

+152
-93
lines changed

19 files changed

+152
-93
lines changed

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ pub(crate) fn get_function_sig<'tcx>(
5353
inst: Instance<'tcx>,
5454
) -> Signature {
5555
assert!(!inst.substs.needs_infer());
56-
clif_sig_from_fn_abi(tcx, triple, &RevealAllLayoutCx(tcx).fn_abi_of_instance(inst, &[]))
56+
clif_sig_from_fn_abi(
57+
tcx,
58+
triple,
59+
&RevealAllLayoutCx(tcx).fn_abi_of_instance(inst, ty::List::empty()),
60+
)
5761
}
5862

5963
/// Instance must be monomorphized
@@ -350,14 +354,13 @@ pub(crate) fn codegen_terminator_call<'tcx>(
350354
};
351355

352356
let extra_args = &args[fn_sig.inputs().len()..];
353-
let extra_args = extra_args
354-
.iter()
355-
.map(|op_arg| fx.monomorphize(op_arg.ty(fx.mir, fx.tcx)))
356-
.collect::<Vec<_>>();
357+
let extra_args = fx
358+
.tcx
359+
.mk_type_list(extra_args.iter().map(|op_arg| fx.monomorphize(op_arg.ty(fx.mir, fx.tcx))));
357360
let fn_abi = if let Some(instance) = instance {
358-
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(instance, &extra_args)
361+
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(instance, extra_args)
359362
} else {
360-
RevealAllLayoutCx(fx.tcx).fn_abi_of_fn_ptr(fn_ty.fn_sig(fx.tcx), &extra_args)
363+
RevealAllLayoutCx(fx.tcx).fn_abi_of_fn_ptr(fn_ty.fn_sig(fx.tcx), extra_args)
361364
};
362365

363366
let is_cold = instance
@@ -525,7 +528,8 @@ pub(crate) fn codegen_drop<'tcx>(
525528
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
526529
substs: drop_instance.substs,
527530
};
528-
let fn_abi = RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(virtual_drop, &[]);
531+
let fn_abi =
532+
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(virtual_drop, ty::List::empty());
529533

530534
let sig = clif_sig_from_fn_abi(fx.tcx, fx.triple(), &fn_abi);
531535
let sig = fx.bcx.import_signature(sig);
@@ -534,7 +538,8 @@ pub(crate) fn codegen_drop<'tcx>(
534538
_ => {
535539
assert!(!matches!(drop_instance.def, InstanceDef::Virtual(_, _)));
536540

537-
let fn_abi = RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(drop_instance, &[]);
541+
let fn_abi =
542+
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(drop_instance, ty::List::empty());
538543

539544
let arg_value = drop_place.place_ref(
540545
fx,

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub(crate) fn codegen_fn<'tcx>(
6161
instance,
6262
symbol_name,
6363
mir,
64-
fn_abi: Some(RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, &[])),
64+
fn_abi: Some(RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, ty::List::empty())),
6565

6666
bcx,
6767
block_map,

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for FunctionCx<'_, '_, 'tcx> {
276276
&self,
277277
err: FnAbiError<'tcx>,
278278
span: Span,
279-
fn_abi_request: FnAbiRequest<'_, 'tcx>,
279+
fn_abi_request: FnAbiRequest<'tcx>,
280280
) -> ! {
281281
RevealAllLayoutCx(self.tcx).handle_fn_abi_err(err, span, fn_abi_request)
282282
}
@@ -402,7 +402,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> {
402402
&self,
403403
err: FnAbiError<'tcx>,
404404
span: Span,
405-
fn_abi_request: FnAbiRequest<'_, 'tcx>,
405+
fn_abi_request: FnAbiRequest<'tcx>,
406406
) -> ! {
407407
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
408408
self.0.sess.span_fatal(span, &err.to_string())

compiler/rustc_codegen_cranelift/src/pretty_clif.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ impl CommentWriter {
8080
vec![
8181
format!("symbol {}", tcx.symbol_name(instance).name),
8282
format!("instance {:?}", instance),
83-
format!("abi {:?}", RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, &[])),
83+
format!(
84+
"abi {:?}",
85+
RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, ty::List::empty())
86+
),
8487
String::new(),
8588
]
8689
} else {

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl FnAbiOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
107107
&self,
108108
err: FnAbiError<'tcx>,
109109
span: Span,
110-
fn_abi_request: FnAbiRequest<'_, 'tcx>,
110+
fn_abi_request: FnAbiRequest<'tcx>,
111111
) -> ! {
112112
self.cx.handle_fn_abi_err(err, span, fn_abi_request)
113113
}

compiler/rustc_codegen_llvm/src/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn get_fn(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) -> &'ll Value
4242
sym
4343
);
4444

45-
let fn_abi = cx.fn_abi_of_instance(instance, &[]);
45+
let fn_abi = cx.fn_abi_of_instance(instance, ty::List::empty());
4646

4747
let llfn = if let Some(llfn) = cx.get_declared_value(&sym) {
4848
// Create a fn pointer with the new signature.

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ impl FnAbiOfHelpers<'tcx> for CodegenCx<'ll, 'tcx> {
867867
&self,
868868
err: FnAbiError<'tcx>,
869869
span: Span,
870-
fn_abi_request: FnAbiRequest<'_, 'tcx>,
870+
fn_abi_request: FnAbiRequest<'tcx>,
871871
) -> ! {
872872
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
873873
self.sess().span_fatal(span, &err.to_string())

compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ fn declare_unused_fn(cx: &CodegenCx<'ll, 'tcx>, def_id: &DefId) -> Instance<'tcx
208208
hir::Unsafety::Unsafe,
209209
Abi::Rust,
210210
)),
211-
&[],
211+
ty::List::empty(),
212212
),
213213
);
214214

compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn make_mir_scope(
9393
ty::ParamEnv::reveal_all(),
9494
callee,
9595
);
96-
let callee_fn_abi = cx.fn_abi_of_instance(callee, &[]);
96+
let callee_fn_abi = cx.fn_abi_of_instance(callee, ty::List::empty());
9797
cx.dbg_scope_fn(callee, &callee_fn_abi, None)
9898
}
9999
None => unsafe {

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ fn gen_fn<'ll, 'tcx>(
737737
rust_fn_sig: ty::PolyFnSig<'tcx>,
738738
codegen: &mut dyn FnMut(Builder<'_, 'll, 'tcx>),
739739
) -> (&'ll Type, &'ll Value) {
740-
let fn_abi = cx.fn_abi_of_fn_ptr(rust_fn_sig, &[]);
740+
let fn_abi = cx.fn_abi_of_fn_ptr(rust_fn_sig, ty::List::empty());
741741
let llty = fn_abi.llvm_type(cx);
742742
let llfn = cx.declare_fn(name, &fn_abi);
743743
cx.set_frame_pointer_type(llfn);

0 commit comments

Comments
 (0)