pub enum AggregateKind {
Adt(TypeId, Option<VariantId>, Option<FieldId>, GenericArgs),
Array(Ty, ConstGeneric),
Closure(FunDeclId, GenericArgs),
}
Expand description
An aggregated ADT.
Note that ADTs are desaggregated at some point in MIR. For instance, if we have in Rust:
let ls = Cons(hd, tl);
In MIR we have (yes, the discriminant update happens at the end for some reason):
(ls as Cons).0 = move hd;
(ls as Cons).1 = move tl;
discriminant(ls) = 0; // assuming `Cons` is the variant of index 0
Rem.: in the Aeneas semantics, both cases are handled (in case of desaggregated
initialization, ls
is initialized to ⊥
, then this ⊥
is expanded to
Cons (⊥, ⊥)
upon the first assignment, at which point we can initialize
the field 0, etc.).
Variants§
Adt(TypeId, Option<VariantId>, Option<FieldId>, GenericArgs)
A struct, enum or union aggregate. The VariantId
, if present, indicates this is an enum
and the aggregate uses that variant. The FieldId
, if present, indicates this is a union
and the aggregate writes into that field. Otherwise this is a struct.
Array(Ty, ConstGeneric)
We don’t put this with the ADT cas because this is the only built-in type with aggregates, and it is a primitive type. In particular, it makes sense to treat it differently because it has a variable number of fields.
Closure(FunDeclId, GenericArgs)
Aggregated values for closures group the function id together with its state.
Implementations§
source§impl AggregateKind
impl AggregateKind
pub fn variant_index_arity(&self) -> (u32, usize)
Trait Implementations§
source§impl Clone for AggregateKind
impl Clone for AggregateKind
source§fn clone(&self) -> AggregateKind
fn clone(&self) -> AggregateKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AggregateKind
impl Debug for AggregateKind
source§impl<'de> Deserialize<'de> for AggregateKind
impl<'de> Deserialize<'de> for AggregateKind
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl DriveMut for AggregateKind
impl DriveMut for AggregateKind
Auto Trait Implementations§
impl Freeze for AggregateKind
impl RefUnwindSafe for AggregateKind
impl Send for AggregateKind
impl Sync for AggregateKind
impl Unpin for AggregateKind
impl UnwindSafe for AggregateKind
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more