Stream: t-compiler/wg-polonius

Topic: workaround for known improperly reduced borrows

Wodann (Jul 12 2020 at 16:53, on Zulip):

If I understand correctly, Polonius is aimed at resolving several known issues with the Rust lifetimes, such as those listed here: . As Polonius is currently only available on nightly, I was wondering whether there are any available resources for overcoming these lifetime issues - be it with safe or unsafe code - on stable? I am particularly interested in the match use case, but I think it would be useful overall.

Jake Goulding (Jul 12 2020 at 17:46, on Zulip):

AFAIK, all lifetime issues can we worked-around using unsafe code. You "just" convert all the lifetimes to 'static (and optionally convert it back to something appropriate). Hopefully it's obvious why this is rarely used.

Jake Goulding (Jul 12 2020 at 17:47, on Zulip):

See also Returning a reference from a HashMap or Vec causes a borrow to last beyond the scope it's in?

Wodann (Jul 15 2020 at 08:00, on Zulip):

Thanks. I was afraid that was the only solution.

Last update: Jun 20 2021 at 01:00UTC