I’m coming from the Java world and some terminology used in Rust seems wrong to me. I’m talking about the drop(&mut self) function declared in the Drop trait. Rustaceans call this function a destructor and this seems wrong to me. Although the Rust programming language doesn’t have a garbage collector it relates to languages with automatic memory management. It just uses another approach to manage the memory automatically. Thus the work the drop(&mut self) function should do is smaller than the work a destructor in a similar C++ code should do. The main difference is that the drop(&mut self) function doesn’t need to destruct any member object. By object destruction I mean what the delete operator in C++ does.
I think the right description name of the drop(&mut self) function should be a finalizer and not a destructor. The functionality of the drop(&mut self) function seems to me solely as an object finalization before a destruction of any part of it. Just like the functionality of the finalize() method in Java. The only difference is that in Java the finalize() method call is non-deterministic because it’s called by the garbage collector.
Even Brian Anderson from Mozilla was confused between those description names of drop in Rust: