[Media] There actually are two bugs in this code
![[Media] There actually are two bugs in this code](https://i.redd.it/k7zudqi8bvaf1.jpeg)
I have seen this meme quite a number of times on different platforms, and I was curious if this was just a random Rust code snippet or if there is actually a bug here
As it turns out, this does not compile for two reasons!
!
if p.borrow().next == None { break; }does not work becauseNodedoes not implementPartialEq. This can be fixed by either deriving the trait or using.is_none()instead.!<!
p = p.borrow().next.clone().unwrap();does not pass the borrow checker becausepis borrowed twice, once immutably by the right-hand side and once mutably by the left-hand side of the assignment, and the borrow checker does not realize the immutable borrow can be shortened to just after the call to.clone(). This can be fixed as follows:p = {p.borrow().next.clone()}.unwrap();!<
So the correct response to the captcha is to click >!the two boxes in the middle row!!<