pub enum PlaneNode {
Type(Meta),
NoType,
Character,
PointerSlot(u8),
}Expand description
One entry in the type plane’s vocabulary, per spec/safe-memory/09-type-init-and-races.md
section 9.1.
The plane maps every byte to one of these, so this is what a meta_type writes and what a
check_type is asking about. Three of the four are the distinguished values that document
says the plane has beyond the types themselves, and they are why the plane needs a node kind
of its own rather than pointing straight at an aliasing node: there is no aliasing node for
“nobody has stored here yet”.
Variants§
Type(Meta)
A type, named by the aliasing node that is that type.
The same node the front end already interned, so the plane’s vocabulary is exactly the compiler’s and a report can name a type in the spelling the source used.
NoType
Bytes nothing has stored through, or stored from an untyped source.
Compatible with every access, because storage with no declared type takes its effective type from the store, which is C’s rule and is also the only choice that does not fire at every boundary with uninstrumented code.
Character
Bytes stored through a character type, which is compatible with every access.
This is what makes the byte-wise copy idiom work. C 6.5 says a character access is
always permitted and that a store through a character lvalue does not set an effective
type, so the plane says character over those bytes and the later read of the field
still passes.
PointerSlot(u8)
Byte k of a pointer shaped word.
A pointer is not one type over its bytes, it is a word whose bytes are only meaningful
together, so reading four bytes out of the middle of one is a different thing from
reading four bytes of an int and the plane has to be able to say which byte it is.