Email or username:

Password:

Forgot your password?
Top-level
Josh Simmons

@iliazeus @lina personally, I approach this by having an explicit destroy function, which consumes the value, and then jamming an assert into the drop path which checks whether you're actually inside the explicit destroy function. You still end up with the unfortunate stuff around std::mem::forget, but in those cases I make sure it's merely a leak rather than a safety violation.

3 comments
iliazeus

@dotstdy the problem with that approach, if I understand it correctly, is that it isn't compile-time. From Lina's post, I somehow thought that there's a compile-time way to do that.

@lina

Go Up