Open laokz opened 3 years ago
Can you say more about what you think is wrong? I think the comment is saying you can't destructure with something like let Vec{ptr, cap, len} = self;
because that would drop it, which it explicitly does not want to do.
Thanks for your quick reply!
My poor english & less rust experience misled me :-/ I thought the comment was for let ptr=self.ptr
, that self.ptr
's type is NonNull
which implemented Copy
trait, so the statement could not destroy the buffer. My bad, sorry.
By the way, how let Vec{ptr, cap, len} = self
would drop it? I tried that self
still accessible after this.
Oh, good point! I don't know what the comment means then. 🙃
https://github.com/rust-lang/nomicon/blob/master/src/vec/vec-into-iter.md#L62