Merge remote-tracking branch 'origin/trunk' into list-str-capacity

This commit is contained in:
Folkert 2022-03-18 18:13:55 +01:00
commit 6134e57921
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
151 changed files with 8702 additions and 2006 deletions

View file

@ -951,11 +951,13 @@ impl<'a> WasmBackend<'a> {
}
_ => internal_error!("Cannot create struct {:?} with storage {:?}", sym, storage),
};
} else {
} else if !fields.is_empty() {
// Struct expression but not Struct layout => single element. Copy it.
let field_storage = self.storage.get(&fields[0]).to_owned();
self.storage
.clone_value(&mut self.code_builder, storage, &field_storage, fields[0]);
} else {
// Empty record. Nothing to do.
}
}