Description
Issue by pnkfelix
Thursday Aug 21, 2014 at 23:34 GMT
For earlier discussion, see rust-lang/rust#16661
This issue was labelled with: in the Rust repository
should struct fields and array elements be dropped in reverse declaration order (a la C++) ?
rust-lang/rust#16493 made us internally consistent with respect to struct fields, but chose to make the drops follow declaration order.
Note struct construction follows the order of the fields given at the construction site, so there's no way to ensure that the drop order is the reverse of the order used at the construction site.
But we should still think about whether we should change that. That is, if local variables are dropped in reverse declaration order (even though they can be initialized in any order), then it seems like it would make sense to do the same thing for struct fields.