Skip to content

fix #44 fixed-array borrow lowering across modules - #46

Open
Overcomplicated12 wants to merge 1 commit into
shuaimu:mainfrom
Overcomplicated12:frank/fix-44
Open

fix #44 fixed-array borrow lowering across modules #46
Overcomplicated12 wants to merge 1 commit into
shuaimu:mainfrom
Overcomplicated12:frank/fix-44

Conversation

@Overcomplicated12

Copy link
Copy Markdown

Summary

Fix cross-module lowering for borrows of fixed-array locals.

When passing &local or &mut local where local has type [T; N], codegen now emits the bare local lvalue instead of applying slice/reference coercions. This preserves compatibility with emitted std::array<T, N>& and const std::array<T, N>& parameters.

Changes

  • Detect stable fixed-array local borrows in common call-argument lowering.
  • Emit dump32(v, b) and load32(b) for the cross-module varint case.
  • Preserve existing lowering for rvalues, literals, fields, raw pointers, and non-array borrows.
  • Add a crate-mode regression fixture that emits separate varint.cppm and serde.cppm modules.

Verification

  • cargo test -p rusty-cpp-transpiler --test e2e_basic
  • cargo test -p rusty-cpp-transpiler --bin rusty-cpp-transpiler

Fixes #44.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

array-reference lowering: argument position (as_slice / address-of) disagrees with parameter position (std::array&)

1 participant