Function validate_slot_map_behavior

Source
pub(crate) fn validate_slot_map_behavior() -> SlotMapValidationToken
Expand description

Spot-check whether SlotMap has changed its key encoding behavior; panic if so.

(Our implementation relies on our ability to check whether a version number is about to overflow. But the only efficient way to access a version number is via KeyData::as_ffi, which does not guarantee anything about the actual encoding of the versions.)

This function returns a ZST ValidationToken; nothing else must return one. Being able to construct a ValidationToken implies that slotmap has probably not changed its behavior in a way that will break us.

§Panics

May panic if slotmap does not encode its keys in the expected manner.