Skip to content

Commit 7db5002

Browse files
committed
Add correct from_bytes type
1 parent a07a40f commit 7db5002

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,12 @@ void ConverterRefCount::AddByteReprTrait(const clang::RecordDecl *decl) {
585585
for (auto *field : decl->fields()) {
586586
auto byte_off = layout.getFieldOffset(idx) / 8;
587587
auto byte_size = ctx_.getTypeSize(field->getType()) / 8;
588+
PushConversionKind push(*this, ConversionKind::FullRefCount);
589+
std::string storage_ty = ToString(field->getType());
590+
Unwrap(storage_ty, "Value<", ">");
588591
StrCat(std::format(
589592
"{}: Rc::new(RefCell::new(<{}>::from_bytes(&buf[{}..{}]))),",
590-
GetNamedDeclAsString(field), Mapper::Map(field->getType()), byte_off,
593+
GetNamedDeclAsString(field), storage_ty, byte_off,
591594
byte_off + byte_size));
592595
++idx;
593596
}

0 commit comments

Comments
 (0)