Skip to content

bugfix - preserve by-value generic Rust call arguments (#609)#611

Merged
dannymeijer merged 1 commit into
mainfrom
bugfix-609-rust-interop-decode
May 20, 2026
Merged

bugfix - preserve by-value generic Rust call arguments (#609)#611
dannymeijer merged 1 commit into
mainfrom
bugfix-609-rust-interop-decode

Conversation

@dannymeijer
Copy link
Copy Markdown
Contributor

Summary

This PR fixes Rust interop call emission for metadata-backed associated functions whose inspected signature takes a generic parameter by value, such as decode<T: Buf>(buf: T). The typechecker now preserves plain Rust type variables as exact by-value call-site parameters and the backend honors that explicit external signature, so owned cursor arguments are passed directly instead of being fallback-borrowed.

Type of change

  • Bug fix
  • New feature
  • Refactor / maintenance
  • Documentation
  • CI / tooling
  • RFC (adds/updates docs/RFCs/*)

Area(s)

Select the primary areas touched (used for review routing; labels are managed separately):

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Tooling (CLI/formatter/test runner)
  • Editor integration (LSP/VS Code extension)
  • Runtime / Core crates (stdlib/core/derive)
  • Documentation

Key details

  • User-facing behavior: Rust interop calls to prost-style decode methods, for example FileDescriptorSet.decode(cursor), now pass owned cursor values directly when the Rust signature accepts T: Buf by value.
  • Internals: Rust boundary matching now treats direct Rust type variables as exact by-value parameter matches, records exact call-site parameter shape only when inspected params contain TypeVar, and method emission keeps explicit external generic params on the external call-arg path.
  • Risks: The touched paths affect Rust interop argument shaping. The main risk is a regression in borrow/coercion decisions for external Rust calls; focused regressions and the full local gate cover the by-value generic path and adjacent Rust interop behavior.

Testing / verification

  • make test / cargo test
  • make examples (if relevant)
  • incan fmt --check . (if relevant)
  • Manual verification described below

Manual verification notes:

  • make pre-commit passed after the final commit, including formatting, rustdoc, 2435 nextest tests, LSP focused tests, clippy, cargo-deny, and smoke-test-fast.
  • Focused regression coverage added for frontend Rust boundary metadata, backend method emission, and an end-to-end CLI project using a local decode<T: DecodeBuf>(T) helper crate.

Docs impact

  • No docs changes needed
  • Docs updated
  • Docs follow Divio intent (tutorial/how-to/reference/explanation) where applicable

If docs updated:

  • Link(s): workspaces/docs-site/docs/release_notes/0_3.md

Checklist

  • I kept public docs user-focused and moved internals to contributing docs when appropriate
  • I avoided duplicating canonical install/run instructions in multiple places
  • I added/updated tests where it materially reduces regressions

Closes #609

@incan-triage-bot incan-triage-bot Bot added documentation Improvements or additions to documentation incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen) labels May 20, 2026
@dannymeijer dannymeijer marked this pull request as ready for review May 20, 2026 18:43
@dannymeijer dannymeijer self-assigned this May 20, 2026
@dannymeijer dannymeijer added this to the 0.3 Release milestone May 20, 2026
@dannymeijer dannymeijer merged commit f959a64 into main May 20, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug - Rust interop over-borrows generic by-value decode arguments

1 participant