When is transmuting lifetimes useful?

I've only seen it in one place so far -- to work around lifetime issues of self-referential structs e.g.: https://github.com/rust-lang/backtrace-rs/blob/master/src/symbolize/gimli.rs#L72

That said, I'm rather new to Rust so I'm sure this is not the only real world use case.

Edit: Here's a shorter example of the above: Saving variables interwoven by reference in one structure - #13 by alice

1 Like