Skip to content

Commit

Permalink
Rollup merge of rust-lang#110872 - Jules-Bertholet:err-67981, r=wesle…
Browse files Browse the repository at this point in the history
…ywiser

Nicer ICE for rust-lang#67981

Provides a slightly nicer ICE for rust-lang#67981, documenting the problem. A proper fix will be necessary before `#![feature(unsized_fn_params)]` can be stabilized.

The problem is that the design of the `"rust-call"` ABI is fundamentally not compatible with `unsized_fn_params`. `"rust-call"` functions need to collect their arguments into a tuple, but if the arguments are not `Sized`, said tuple is potentially not even a valid type—and if it is, it requires `alloca` to create.

``@rustbot`` label +A-abi +A-codegen +F-unboxed_closures +F-unsized_fn_params
  • Loading branch information
matthiaskrgr authored Apr 27, 2023
2 parents 1ca3f33 + 5b6e747 commit 52d550b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,17 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bug!("spread argument isn't a tuple?!");
};

let place = PlaceRef::alloca(bx, bx.layout_of(arg_ty));
let layout = bx.layout_of(arg_ty);

// FIXME: support unsized params in "rust-call" ABI
if layout.is_unsized() {
span_bug!(
arg_decl.source_info.span,
"\"rust-call\" ABI does not support unsized params",
);
}

let place = PlaceRef::alloca(bx, layout);
for i in 0..tupled_arg_tys.len() {
let arg = &fx.fn_abi.args[idx];
idx += 1;
Expand Down

0 comments on commit 52d550b

Please sign in to comment.