Implement Clone, Debug for iterators#543
Implement Clone, Debug for iterators#543clarfonthey wants to merge 1 commit intorust-lang:masterfrom
Clone, Debug for iterators#543Conversation
b2d3cce to
05a6185
Compare
| #[derive(Clone)] | ||
| pub struct RawIntoIter<T, A: Allocator = Global> { | ||
| iter: RawIter<T>, | ||
| allocation: Option<(NonNull<u8>, Layout, A)>, |
There was a problem hiding this comment.
This is not going to work correctly since it will end up double-freeing the underlying allocation.
There was a problem hiding this comment.
Right, that makes sense.
I'll look into actually cloning the allocation instead.
|
Going to close this per: rust-lang/rust#128711 (comment) I have some ideas on a refactor that would make implementing I posted some less constructive feedback earlier today, but the long story short is that I think that there need to be more safe wrappers on the internals in the code, rather than every single usage of the raw table being unsafe. I need to do more reading into the code before I make a proper writeup though, so, stay tuned. Also poked through the currently filed issues just to check for prior art before I start this, and #290 feels relevant here as well. Will want to link that in the issue I file. (Note to self.) |
Follow-up to #542 after I noticed these were missing too. A more complete implementation of #541.
Adds:
Cloneforraw::Iterandraw::IntoIterClonefor iterators that useraw::IntoIterinternallyDebugimplementations forraw::Iter,raw::IterMut, andraw::IntoIteriteranditer_mutmethods toraw::IntoIter(onlyiteris needed forDebug, but I decided to add these as public since map and setIntoIterseem to have publicitermethods)