You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For smart pointers to be implemented as library types, the drop flag needs to be omitted and the pointer zeroed instead. Calling the destructor more than once will be fine, free is a no-op on null pointers.
The text was updated successfully, but these errors were encountered:
This adds a `#[no_drop_flag]` attribute. This attribute tells the compiler to omit the drop flag from the struct, if it has a destructor. When the destructor is run, instead of setting the drop flag, it instead zeroes-out the struct. This means the destructor can run multiple times and therefore it is up to the developer to use it safely.
The primary usage case for this is smart-pointer types like `Rc<T>` as the extra flag caused the struct to be 1 word larger because of alignment.
This closes#7271 and #7138
For smart pointers to be implemented as library types, the drop flag needs to be omitted and the pointer zeroed instead. Calling the destructor more than once will be fine,
free
is a no-op on null pointers.The text was updated successfully, but these errors were encountered: