Skip to content

Commit 0e6ae56

Browse files
committed
Add correct from_bytes type
1 parent b7bf1bf commit 0e6ae56

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
@@ -541,9 +541,12 @@ void ConverterRefCount::AddByteReprTrait(const clang::RecordDecl *decl) {
541541
for (auto *field : decl->fields()) {
542542
auto byte_off = layout.getFieldOffset(idx) / 8;
543543
auto byte_size = ctx_.getTypeSize(field->getType()) / 8;
544+
PushConversionKind push(*this, ConversionKind::FullRefCount);
545+
std::string storage_ty = ToString(field->getType());
546+
Unwrap(storage_ty, "Value<", ">");
544547
StrCat(std::format(
545548
"{}: Rc::new(RefCell::new(<{}>::from_bytes(&buf[{}..{}]))),",
546-
GetNamedDeclAsString(field), Mapper::Map(field->getType()), byte_off,
549+
GetNamedDeclAsString(field), storage_ty, byte_off,
547550
byte_off + byte_size));
548551
++idx;
549552
}

0 commit comments

Comments
 (0)