|
|
|
|
|
by masklinn
847 days ago
|
|
> Also, in my understanding is that in Rust, sometimes a dynamic state is created when the object may or may not be moved. Yes? if cond {
drop(p)
}
// p may or may not be dropped here
or let p;
if cond {
p = something();
}
// p may or may not be set here
These trigger dynamic drop semantics, in which case the stackframe has a hidden set of drop flags going alongside any variable with dynamic drop semantics, to know if they do or don’t need to be dropped. The flags are automatically updated when the corresponding variables are set or moved-from. |
|