Description
Many formal verification tools need generate metadata as part of the compilation of a crate, particularily so that crate can then be used in downstream projects. This is fine so long as no rustc datastructures are involved, but the moment they are things become much less clear.
Serializing rustc datastructures seems to be exactly the role of TyEncodable
and TyEncoder
but figuring out how to actually use this to serialize a custom map / table of some kind is... not easy.
What I'm searching for is a mechanism which is capable of serializing a custom map which contains various DefId
, SubstsRef
and Ty
s and which is then capable of deserializing it within another crate. On its surface this seems to be exactly what the metadata system of rustc does, just with a custom table.