Skip to main content

PlaneNode

Enum PlaneNode 

Source
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.

Trait Implementations§

Source§

impl Clone for PlaneNode

Source§

fn clone(&self) -> PlaneNode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PlaneNode

Source§

impl Debug for PlaneNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PlaneNode

Source§

impl PartialEq for PlaneNode

Source§

fn eq(&self, other: &PlaneNode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlaneNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.