Compile higher-order low-level calls that take functions with no closure args

Closes #3571
This commit is contained in:
Ayaz Hafiz 2022-07-19 15:50:36 -04:00
parent 7b9b855dcc
commit 2cdb951752
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 47 additions and 14 deletions

View file

@ -433,14 +433,15 @@ fn build_transform_caller_help<'a, 'ctx, 'env>(
arguments_cast.push(argument);
}
match closure_data_layout.runtime_representation() {
Layout::Struct {
field_layouts: &[], ..
} => {
// nothing to add
match (
closure_data_layout.is_represented().is_some(),
closure_data_layout.runtime_representation(),
) {
(false, _) => {
// the function doesn't expect a closure argument, nothing to add
}
other => {
let closure_type = basic_type_from_layout(env, &other).ptr_type(AddressSpace::Generic);
(true, layout) => {
let closure_type = basic_type_from_layout(env, &layout).ptr_type(AddressSpace::Generic);
let closure_cast = env
.builder