cannot have Direct for unsized types

This commit is contained in:
Ralf Jung 2023-09-15 10:45:32 +02:00
parent 29a4b7b971
commit 3ee65c28e9
1 changed files with 5 additions and 0 deletions

View File

@ -351,6 +351,11 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
// guarnateeing that we generate ABI-compatible LLVM IR. Things get tricky for // guarnateeing that we generate ABI-compatible LLVM IR. Things get tricky for
// aggregates... // aggregates...
if matches!(arg.layout.abi, abi::Abi::Aggregate { .. }) { if matches!(arg.layout.abi, abi::Abi::Aggregate { .. }) {
assert!(
arg.layout.is_sized(),
"`PassMode::Direct` for unsized type: {}",
arg.layout.ty
);
// This really shouldn't happen, since `immediate_llvm_type` will use // This really shouldn't happen, since `immediate_llvm_type` will use
// `layout.fields` to turn this Rust type into an LLVM type. This means all // `layout.fields` to turn this Rust type into an LLVM type. This means all
// sorts of Rust type details leak into the ABI. However wasm sadly *does* // sorts of Rust type details leak into the ABI. However wasm sadly *does*