4 ms·
> invalid = leaks memory Not quite true- invalid use of lifetimes typically means use-after-free rather than a memory leak (and if you include the standard lib
by Rusky 11y ago
> invalid = leaks memory
Not quite true- invalid use of lifetimes typically means use-after-free rather than a memory leak (and if you include the standard library, then you can leak memory in safe Rust).
- tatterdemalion 11y agoIts interesting to me how everyone goes to "memory leaks" as their example of memory unsafety, and then if we're talking about Rust we need to clarify that Rust allows leaks (but it makes them hard to do by accident). I guess mnemonically "memory leak" is easier to bring to mind than "dangling pointer" when talking about memory.
- Gankro 11y agoIt's also funny because memory leaks literally aren't a memory safety issue. If they were, every garbage collected language would be memory-unsafe.