Skip to content

Commit a28d527

Browse files
committed
Add FIXME comments for splat in tools
1 parent 5fcfb4e commit a28d527

12 files changed

Lines changed: 14 additions & 1 deletion

File tree

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
265265
.map(|local| {
266266
let arg_ty = fx.monomorphize(fx.mir.local_decls[local].ty);
267267

268+
// FIXME(splat): un-tuple splatted arguments in codegen, for performance
268269
// Adapted from https://github.com/rust-lang/rust/blob/145155dc96757002c7b2e9de8489416e2fdbbd57/src/librustc_codegen_llvm/mir/mod.rs#L442-L482
269270
if Some(local) == fx.mir.spread_arg {
270271
// This argument (e.g. the last argument in the "rust-call" ABI)

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ fn push_debuginfo_type_name<'tcx>(
375375
output.push_str("fn(");
376376
}
377377

378+
// FIXME(splat): should debuginfo be de-tupled in the callee (and caller)?
378379
if !sig.inputs().is_empty() {
379380
for &parameter_type in sig.inputs() {
380381
push_debuginfo_type_name(tcx, parameter_type, true, output, visited);

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11371137
};
11381138

11391139
// Split the rust-call tupled arguments off.
1140+
// FIXME(splat): un-tuple splatted arguments in codegen, for performance
11401141
let (first_args, untuple) = if sig.abi() == ExternAbi::RustCall
11411142
&& let Some((tup, args)) = args.split_last()
11421143
{

compiler/rustc_codegen_ssa/src/mir/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
402402
let arg_decl = &mir.local_decls[local];
403403
let arg_ty = fx.monomorphize(arg_decl.ty);
404404

405+
// FIXME(splat): re-tuple splatted arguments that were un-tupled in the ABI
405406
if Some(local) == mir.spread_arg {
406407
// This argument (e.g., the last argument in the "rust-call" ABI)
407408
// is a tuple that was spread at the ABI level and now we have

compiler/rustc_const_eval/src/interpret/call.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
653653
};
654654

655655
// Special handling for the closure ABI: untuple the last argument.
656+
// FIXME(splat): un-tuple splatted arguments that were tupled in typecheck
656657
let args: Cow<'_, [FnArg<'tcx, M::Provenance>]> =
657658
if caller_abi == ExternAbi::RustCall && !args.is_empty() {
658659
// Untuple

src/tools/miri/src/helpers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
407407
let sig = this.tcx.mk_fn_sig(
408408
args.iter().map(|a| a.layout.ty),
409409
dest.layout.ty,
410+
// FIXME(splat): Do we need to set splatted here?
411+
// (Currently this also ignores c_variadic)
410412
FnSigKind::default().set_abi(caller_abi).set_safe(true),
411413
);
412414
let caller_fn_abi = this.fn_abi_of_fn_ptr(ty::Binder::dummy(sig), ty::List::empty())?;

src/tools/miri/src/shims/sig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
274274
inputs_and_output.push(shim_sig.ret);
275275
let fn_sig_binder = Binder::dummy(FnSig {
276276
inputs_and_output: this.machine.tcx.mk_type_list(&inputs_and_output),
277-
// Safety does not matter for the ABI.
277+
// Safety and splatted do not matter for the ABI.
278278
fn_sig_kind: FnSigKind::default().set_abi(shim_sig.abi).set_safe(true),
279279
});
280280
let callee_fn_abi = this.fn_abi_of_fn_ptr(fn_sig_binder, Default::default())?;

src/tools/rust-analyzer/crates/hir-ty/src/infer/callee.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ impl<'db> InferenceContext<'_, 'db> {
159159
// impl forces the closure kind to `FnOnce` i.e. `u8`.
160160
let kind_ty = autoderef.ctx().table.next_ty_var();
161161
let interner = autoderef.ctx().interner();
162+
163+
// Ignore splatting, it is unsupported on closures.
162164
let call_sig = interner.mk_fn_sig(
163165
[coroutine_closure_sig.tupled_inputs_ty],
164166
coroutine_closure_sig.to_coroutine(

src/tools/rust-analyzer/crates/hir-ty/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ pub fn callable_sig_from_fn_trait<'db>(
577577
Binder::dummy(FnSig {
578578
inputs_and_output,
579579
c_variadic: false,
580+
// FIXME(splat): handle splatted arguments
580581
safety: abi::Safety::Safe,
581582
abi: FnAbi::RustCall,
582583
}),

src/tools/rust-analyzer/crates/hir-ty/src/lower.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
574574
abi: fn_.abi.as_ref().map_or(FnAbi::Rust, FnAbi::from_symbol),
575575
safety: if fn_.is_unsafe { Safety::Unsafe } else { Safety::Safe },
576576
c_variadic: fn_.is_varargs,
577+
// FIXME(splat): handle splatted arguments
577578
inputs_and_output: Tys::new_from_slice(&args),
578579
}),
579580
)

0 commit comments

Comments
 (0)