icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Always use discriminant marker in ZeroTrie serialized form

Open sffc opened this issue 1 year ago • 2 comments

Currently the discriminant marker is only used in the ZeroTrie enum. It is not used in ZeroTrieSimpleAscii, etc. This is potentially error-prone since a ZeroTrie created from one type can be cast into another type with no way to detect the error in most cases until a debug assertion is hit. It would be safer to write out the discriminant in all cases even when the enum is not used. It also means it is easier to generalize from a specific type to a general type and vice-versa.

Should do after #4031 and before 1.5

sffc avatar Jan 31 '24 02:01 sffc

Discuss with:

  • @robertbastian
  • @sffc

Optional:

  • @Manishearth

sffc avatar Feb 29 '24 18:02 sffc

Resolution: OK to do this if it impacts only Serde and is reasonably backwards compatible.

sffc avatar Mar 11 '24 13:03 sffc