elastic-array icon indicating copy to clipboard operation
elastic-array copied to clipboard

Soundness with general (non-Copy) elements, and some Copy elements too.

Open bluss opened this issue 10 years ago • 5 comments

Using uninitialized, you run into the same soundness issues already explored by crates arrayvec and smallvec.

See bugs servo/rust-smallvec/issues/4 and servo/rust-smallvec/issues/5

bluss avatar Dec 07 '15 18:12 bluss

The second issue is actually an example of soundness issues with a Copy element type (&T).

bluss avatar Dec 07 '15 18:12 bluss

Another grueling lesson I had to learn: servo/rust-smallvec/pull/15 :-)

bluss avatar Dec 07 '15 18:12 bluss

thanks for suggestions!!! I prepare a fix in next version :)

debris avatar Dec 09 '15 23:12 debris

btw. I really like how arrayvec is done. :+1: This library was just hacked quickly for my personal project. If I create a pr to arrayvec with decent, structured code implementing extensible array, would you accept it?

debris avatar Dec 10 '15 00:12 debris

Since you ask, no, that's outside of the scope for arrayvec. Isn't that what smallvec covers?

This functionality is often recreated, nothing bad in that, instead it's just a symptom of that: Arrays in rust are not so nice to work with yet (no integer generics), and there is no solution in the libstd. I just wanted to chime in with some tips, I like to help make code safe, so that Rust can be a "safe language" in practice.

bluss avatar Dec 10 '15 01:12 bluss