by PartiallyTyped · 3y ago · 0 comments
There's a rust front-end for gcc as well.
Doesn’t the borrow checker also track when things fall out of scope, and thus control when Drop is called?
Find the scope you can refer to the variable in, i.e. the curly brackets it is contained in. That variable is dropped right before the closing curly bracket. Things are dropped in reverse order of creation.
(Similar rules apply to dropping temporaries)
The drop is there for stuff that you can't just release the memory for, such as closing files and connections.