Skip to content

feat: enhanced array conversion and drop#59

Merged
fredszaq merged 1 commit intosonos:mainfrom
carlocorradini:uninit
Apr 15, 2026
Merged

feat: enhanced array conversion and drop#59
fredszaq merged 1 commit intosonos:mainfrom
carlocorradini:uninit

Conversation

@carlocorradini
Copy link
Copy Markdown
Contributor

@carlocorradini carlocorradini commented Apr 15, 2026

CReprOf and AsRust for arrays have been improved by eliminating the temporary vector using an array of MaybeUninit along with additional logic to prevent memory leaks.

CReprOf explicitly calls CDrop::do_drop on initialized items if an error occurs.
AsRust calls MaybeUninit::assume_init_drop on initialized items if an error occurs.
CDrop calls CDrop::do_dropon each element in the array, returning the first error encountered, if any.

PS: The code is inspired and adapted from sharksforarms/deku/src/impls/slice.rs, for which I’ve submitted PR sharksforarms/deku#601

fredszaq added a commit that referenced this pull request Apr 15, 2026
@fredszaq fredszaq merged commit e00d6b7 into sonos:main Apr 15, 2026
1 check passed
@fredszaq
Copy link
Copy Markdown
Collaborator

Thanks a lot @carlocorradini ! This is waaaay better than what we had before !

@fredszaq fredszaq mentioned this pull request Apr 15, 2026
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.

2 participants