A question about mutable borrow methods

I am reading Learning Rust With Entirely Too Many Linked Lists.
when I am reading the unsafe queue ,the compiler reports "cannot borrow list as mutable more than once at a time"
, but In A bad stack , pop() and
push () methods still use mutable borrow serveral times in tests code while the compiler works.
My question is what the difference between them?

The difference is that they took the lifetime 'a which is a generic parameter to the struct and put it on &mut self. This never goes well because the lifetimes annotated on a struct are required to be larger than the entire region that the value can exist in, so the call will borrow self until self is destroyed, instead of just until the call returns.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.