3 ms·
> Rust lifetimes are just the lifetimes of the memory, exactly the same as C. Rust lifetimes are only the lifetimes of the memory that are provable by the type
by celeritascelery 4y ago
> Rust lifetimes are just the lifetimes of the memory, exactly the same as C.
Rust lifetimes are only the lifetimes of the memory that are provable by the type system. There are many valid lifetimes that are not provable. For example lifetimes that change at runtime, and self referencing lifetimes, or cyclic lifetimes. Newer versions of the borrow checker enable it to prove more lifetimes correct, but it will never be able to express all valid lifetimes of the actual memory.
This means some patterns the are completely valid cannot be expressed in safe Rust due to the limitations of the type system, but can be expressed in C.
- insanitybit 4y agoAnd you can use unsafe.