about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-27 15:10:56 +0200
committerGitHub <noreply@github.com>2023-04-27 15:10:56 +0200
commit52d550b20ee1a327565b2002ac7f02243d0fa12e (patch)
treec839aa495a143234447b43187b00bfa2e019aa3c /compiler/rustc_codegen_ssa/src
parent1ca3f33ef7b2e83271f42f1b922a21e20516d7cc (diff)
parent5b6e747f37bd75c611674781b7035b2e47bb2d4c (diff)
downloadrust-52d550b20ee1a327565b2002ac7f02243d0fa12e.tar.gz
rust-52d550b20ee1a327565b2002ac7f02243d0fa12e.zip
Rollup merge of #110872 - Jules-Bertholet:err-67981, r=wesleywiser
Nicer ICE for #67981

Provides a slightly nicer ICE for #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
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/mod.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs
index f6e937a740c..f706ecea975 100644
--- a/compiler/rustc_codegen_ssa/src/mir/mod.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs
@@ -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;