too-many-lists icon indicating copy to clipboard operation
too-many-lists copied to clipboard

Add a test to check stack overflow in "fist-drop" section

Open tamuhey opened this issue 3 years ago • 3 comments

I think it is great to add a test to this section to cause stack overflow before implementing our own Drop.

tamuhey avatar May 23 '21 16:05 tamuhey

You can try this in the playground. refering to this post

kolulu23 avatar Jul 20 '21 00:07 kolulu23

tried a bit: playground-2 versions of drop

found that without impl Drop the prog would go stack overflow; with either version of drop it can run successfully.

can i say that both versions of drop are correct ?

while let Some(mut b) = self.head.take() { self.head = b.next.take(); }
while let Some(b) = self.head.take() { self.head = b.next; }

zenyusy avatar May 26 '22 14:05 zenyusy