summaryrefslogtreecommitdiff
path: root/src/Expressions.ml
diff options
context:
space:
mode:
authorSon Ho2022-02-08 13:58:57 +0100
committerSon Ho2022-02-08 13:58:57 +0100
commitc80141a9874345b71ee5e6c37947e1f0825698a7 (patch)
treea1ae43a474169d0b01cbdb8fa1187db2e17ccc81 /src/Expressions.ml
parent33261269a5264b416a0d8d87b9622345c40f2895 (diff)
Start adding more assumed types and functions
Diffstat (limited to 'src/Expressions.ml')
-rw-r--r--src/Expressions.ml7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Expressions.ml b/src/Expressions.ml
index 816870cd..9c6b8490 100644
--- a/src/Expressions.ml
+++ b/src/Expressions.ml
@@ -3,6 +3,8 @@ open Values
type field_proj_kind =
| ProjAdt of TypeDefId.id * VariantId.id option
+ | ProjOption of VariantId.id
+ (** Option is an assumed type, coming from the standard library *)
| ProjTuple of int
[@@deriving show]
(* arity of the tuple *)
@@ -73,6 +75,8 @@ let all_binops =
constants when generating MIR:
- an enumeration with one variant and no fields is a constant.
- a structure with no field is a constant.
+ - sometimes, Rust stores the initialization of an ADT as a constant
+ (if all the fields are constant) rather than as an aggregated value
For our translation, we use the following enumeration to encode those
special cases in assignments. They are converted to "normal" values
@@ -81,8 +85,7 @@ let all_binops =
*)
type operand_constant_value =
| ConstantValue of constant_value
- | ConstantAdt of TypeDefId.id
- | Unit
+ | ConstantAdt of VariantId.id option * operand_constant_value list
[@@deriving show]
type operand =