Emit more Cluster arrays as arrays instead of lists of elements. - #534
Merged
Conversation
Add ArrayProxy for handling Cluster arrays that would be emitted as a rust array except for the need for padding between elements.
|
r? @ryankurte (rust-highfive has picked a reviewer for you, use r? to override) |
Member
|
Make the usage of ArrayProxy dependent on the const_generics config option.
burrbull
reviewed
Jul 20, 2021
Contributor
Author
Thanks. The changes updated to rely on that option. |
rcls
marked this pull request as ready for review
July 20, 2021 08:26
burrbull
approved these changes
Jul 20, 2021
Member
|
bors r+ |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(This obsoletes #531)
Some Cluster arrays cannot be emitted as Rust (built-in) arrays due to padding between elements.
Add a helper zero-sized type
ArrayProxythat overloads[]to do pointer-arithmetic internally.I believe, although I'm not 100% confident, that I'm not breaking Rust safety, as follows: There is no way for (safe) code to create an
ArrayProxy. Code that produces a (reference to) anArrayProxyhas to useunsafesomewhere.See rcls/svd2rust-example@b8645fe for any example of the difference this makes (or does not make):
This uses const generics, so the new functionality requires the
--const_genericcommand line optoin.