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

Audit arrayref #50

Open
Shnatsel opened this issue Nov 2, 2019 · 4 comments
Open

Audit arrayref #50

Shnatsel opened this issue Nov 2, 2019 · 4 comments

Comments

@Shnatsel
Copy link
Member

Shnatsel commented Nov 2, 2019

https://crates.io/crates/arrayref

Macros to take fixed-length slices of memory instead of regular slices. 5000 downloads/day.

@Shnatsel
Copy link
Member Author

Shnatsel commented Nov 2, 2019

It seems the same can be accomplished in 100% safe Rust thanks to TryFrom implementation from arrays to slices.

Example of similar 100% safe code in action: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9d6e1d61835060f832ce1724becb1214

@Shnatsel
Copy link
Member Author

Shnatsel commented Nov 2, 2019

The limitation is that the 100% safe approach only works for sizes up to 32, and will remain so until const generics are stabilized.

@Shnatsel
Copy link
Member Author

Shnatsel commented Nov 2, 2019

Reported possibility of a safe implementation upstream: droundy/arrayref#18

@Shnatsel
Copy link
Member Author

Shnatsel commented Nov 2, 2019

Running miri should be a good way to validate the crate since most of what it's doing is not input-dependent.

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

No branches or pull requests

1 participant