Fix/crashing when draining empty minivec small#19
Fix/crashing when draining empty minivec small#19cmazakas merged 1 commit intocmazakas:developfrom hbina:fix/crashing-when-draining-empty-minivec-small
Conversation
|
Does this one obsolete #18? Do you think we might need to use |
|
This is just a fix that prevents the crash, but still invoking UB because it violates NonNull usage. I'll finish reading https://doc.rust-lang.org/nomicon/subtyping.html first but I think dangling might be the proper use. I don't understand why that other PR changes the covariance thing :/ |
…-vec, r=dtolnay Added tests to drain an empty vec Discovered this kind of issue in an unrelated library. The author copied the tests from here and AFAIK, there are no tests for this particular case. cmazakas/minivec#19 Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
To be fair, it's actually fine for The type system uses this information to optimize where appropriate and it also has effects with regards to covariance (which I'm honestly still figuring out as a Rust noob). |
|
Alright, this looks good and works on my end. Merging. Thank you for the contribution. I appreciate it. |
This is a much shorter that prevents the crash.
However, I think there's still an underlying problem with using
NonNullon aNULLdata.