News for hackers. Stuff that matters.
Re:Learning Rust by dbaupp on Sunday November 02, 2014 @08:30PM (#8548922)
> And you are right. Even though GP is almost right, lifetimes do interact with destructors and, in fact, dictate when those are called.

It's actually the other way around: scoping dictates when destructors are called and the length of the lifetimes of borrowed pointers etc.

That is, the main factor is scoping, and lifetimes just reify that into something the programmer and compiler can reason about, to ensure safety.

Re:Learning Rust by kaoD on Sunday November 02, 2014 @08:42PM (#8548939)
> That is, the main factor is scoping

Sorry, I meant (and I guess myrryr meant too) ownership instead of lifetimes. I was in the process of ninja-editing my comment when I saw your reply :P

Ownership dictates when a value goes out of scope and hence when the destructor is called.