logoalt Hacker News

tialaramextoday at 5:06 PM1 replyview on HN

> It doesn't even get that far: Rust guarantees that things drop in reverse order of declaration, full stop.

The drops happen (if implemented) in the same order, but in a different place, half the point of become is to put any needed drops first before the call, as otherwise it's not in tail position and we can't do the optimisation.

So the borrowck can become involved if our become foo(bar, &baz) borrows baz but baz's type impl Drop - the diagnostics aren't great today, but then the feature isn't finished so it's not a priority.


Replies

steveklabniktoday at 5:22 PM

I was talking about regular old today's Rust, not the specifics about become.