Hey everyone,
I'm implementing a more compact version of std::vec::Vec and I'm running into an interesting compilation failure with one of the tests used for the real Vec.
Namely, I have a test failure here:
https://github.com/LeonineKing1199/minivec/blob/28c081f7e6ab1fbd970fe6c8dbe4f0630483ec88/tests/vec.rs#L856-L858
My IntoIter type is failing to be covariant!
I actually had this test passing before by having core::ptr::NonNull be a member of IntoIter but unfortunately, I was introducing UB by actually passing in a null pointer and my test suite was failing in release mode with an illegal instruction. (Good to know Rust actually optimizes around NonNull)
So now I've fixed the illegal instruction error but now my iterator type is failing to be covariant and I'm not sure how to convey to the compiler that this test should work.
Definition of IntoIter:
https://github.com/LeonineKing1199/minivec/blob/28c081f7e6ab1fbd970fe6c8dbe4f0630483ec88/src/impl/into_iter.rs#L9-L12
Let me know if any more information is required. Honestly, I'd rather live with the illegal instruction fix than having this iterator type be covariant but that's probably because I don't have a use-case where covariance matters for the iterator type yet.