Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use raw pointers to static-sized arrays in FFI signatures #353

Merged
merged 1 commit into from
Jan 2, 2021

Conversation

MarijnS95
Copy link
Collaborator

In rust references to DSTs (Dynamically Sized Types) like slices and
trait objects are 16-bytes instead of 8 (leaking into the next parameter
of a function call). The static-sized array generated here has its size
known beforehand and will not suffer from this issue 1, but might be
confusing for future readers/authors: convert it to a raw pointer just
to be safe.


See #352 (comment) as well :)

In rust references to DSTs (Dynamically Sized Types) like slices and
trait objects are 16-bytes instead of 8 (leaking into the next parameter
of a function call). The static-sized array generated here has its size
known beforehand and will not suffer from this issue [1], but might be
confusing for future readers/authors: convert it to a raw pointer just
to be safe.

[1]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=88acb9736455f7262ecf4af2077f3a59
@MaikKlein MaikKlein merged commit 7fa182c into ash-rs:master Jan 2, 2021
@MarijnS95 MarijnS95 deleted the static-array-raw-ptr branch January 2, 2021 14:08
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.

None yet

2 participants