Repository navigation
[MOD-19126] c_wrapper: add owned and borrowed wrappers for C fat arrays - #11641
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76b5d7fb8d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
d3fff67 to
6e05ec4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11641 +/- ##
==========================================
- Coverage 84.13% 83.53% -0.61%
==========================================
Files 643 669 +26
Lines 85119 86387 +1268
Branches 39311 40561 +1250
==========================================
+ Hits 71617 72160 +543
- Misses 13139 13856 +717
- Partials 363 371 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6e05ec4 to
6b02724
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b02724189
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
6b02724 to
39b925e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39b925e52a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Add the fat_array crate with FatArray, which owns a C fat array, and FatArrayRef, which borrows one for a lifetime, both exposing the elements as a slice. Dropping a FatArray drops each element, then frees the storage with array_free, even if an element's destructor panics. Debug builds check that the array's element size and alignment match T, which requires binding array_hdr_t.
39b925e to
b33e522
Compare
|



Describe the changes in the pull request
arrayof(T)) has to callarray_len_func/array_freeby hand in its ownunsafeblocks, with nothing tying the array's lifetime or ownership to the Rust side.fat_arraycrate underc_wrappers/addsFatArray<T: Copy>, which owns a fat array and frees it on drop, andFatArrayRef<'a, T>, which borrows one (null counts as empty). Both expose the elements as a slice.Which additional issues this PR fixes
N/A
Main objects this PR modified
fat_array::FatArray/FatArrayRef— new safe wrappers over C fat arrays. Their safety contracts require the array's element size and alignment to matchT; debug builds assert both.ffi— bindsarray_hdr_tso that element-size check can read the header.Mark if applicable
Release Notes
If a release note is required (bug fix / new feature / enhancement), describe the user impact of this PR in the title.