Skip to content

Commit

Permalink
Update charon
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Jul 1, 2024
1 parent 5e44147 commit 525c5a3
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charon-pin
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This is the commit from https://github.com/AeneasVerif/charon that should be used with this version of aeneas.
7fb1eaada218a3f010a3dbeb337aad30beac417f
aeeae1d46704810bf498db552a75dff15aa3abcc
8 changes: 7 additions & 1 deletion compiler/AssociatedTypes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let rec trait_instance_id_is_local_clause (id : trait_instance_id) : bool =
match id with
| Self | Clause _ -> true
| TraitImpl _ | BuiltinOrAuto _ | TraitRef _ | UnknownTrait _ | FnPointer _
| Closure _ | Unsolved _ ->
| Closure _ | Unsolved _ | Dyn _ ->
false
| ParentClause (id, _, _) | ItemClause (id, _, _, _) ->
trait_instance_id_is_local_clause id
Expand Down Expand Up @@ -294,6 +294,9 @@ let rec norm_ctx_normalize_ty (ctx : norm_ctx) (ty : ty) : ty =
let tr : trait_type_ref = { trait_ref; type_name } in
(* Lookup the representative, if there is *)
match norm_ctx_get_ty_repr ctx tr with None -> ty | Some ty -> ty)
| TDynTrait _ ->
craise_opt_span __FILE__ __LINE__ ctx.span
"Dynamic trait types are not supported yet"

(** This returns the normalized trait instance id together with an optional
reference to a trait **implementation** (the `trait_ref` we return has
Expand Down Expand Up @@ -449,6 +452,9 @@ and norm_ctx_normalize_trait_instance_id (ctx : norm_ctx)
| Unsolved _ | UnknownTrait _ ->
(* This is actually an error case *)
(id, None)
| Dyn _ ->
craise_opt_span __FILE__ __LINE__ ctx.span
"Dynamic trait types are not supported yet"

and norm_ctx_normalize_generic_args (ctx : norm_ctx) (generics : generic_args) :
generic_args =
Expand Down
3 changes: 2 additions & 1 deletion compiler/InterpreterExpansion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,8 @@ let greedy_expand_symbolics_with_borrows (config : config) (span : Meta.span) :
(* We can't expand those *)
craise __FILE__ __LINE__ span
"Attempted to greedily expand an ADT which can't be expanded "
| TVar _ | TLiteral _ | TNever | TTraitType _ | TArrow _ | TRawPtr _ ->
| TVar _ | TLiteral _ | TNever | TTraitType _ | TArrow _ | TRawPtr _
| TDynTrait _ ->
craise __FILE__ __LINE__ span "Unreachable"
in
(* *)
Expand Down
3 changes: 3 additions & 0 deletions compiler/RegionsHierarchy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ let compute_regions_hierarchy_for_sig (span : Meta.span option)
"We don't support arrow types with locally quantified regions";
(* We can ignore the outer regions *)
List.iter (explore_ty []) (output :: inputs)
| TDynTrait _ ->
craise_opt_span __FILE__ __LINE__ span
"Dynamic trait types are not supported yet"
and explore_generics (outer : region list) (generics : generic_args) =
let { regions; types; const_generics = _; trait_refs = _ } = generics in
List.iter (fun long -> add_edges ~long ~shorts:outer) regions;
Expand Down
12 changes: 11 additions & 1 deletion compiler/SymbolicToPure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ and translate_trait_instance_id (span : Meta.span) (translate_ty : T.ty -> ty)
| TraitRef tr -> TraitRef (translate_trait_ref span translate_ty tr)
| FnPointer _ | Closure _ ->
craise __FILE__ __LINE__ span "Closures are not supported yet"
| Dyn _ ->
craise __FILE__ __LINE__ span "Dynamic trait types are not supported yet"
| Unsolved _ -> craise __FILE__ __LINE__ span "Couldn't solve trait bound"
| UnknownTrait s -> craise __FILE__ __LINE__ span ("Unknown trait found: " ^ s)

Expand Down Expand Up @@ -496,6 +498,8 @@ let rec translate_sty (span : Meta.span) (ty : T.ty) : ty =
TTraitType (trait_ref, type_name)
| TArrow _ ->
craise __FILE__ __LINE__ span "Arrow types are not supported yet"
| TDynTrait _ ->
craise __FILE__ __LINE__ span "Dynamic trait types are not supported yet"

and translate_sgeneric_args (span : Meta.span) (generics : T.generic_args) :
generic_args =
Expand Down Expand Up @@ -672,6 +676,8 @@ let rec translate_fwd_ty (span : Meta.span) (type_infos : type_infos)
TTraitType (trait_ref, type_name)
| TArrow _ ->
craise __FILE__ __LINE__ span "Arrow types are not supported yet"
| TDynTrait _ ->
craise __FILE__ __LINE__ span "Dynamic trait types are not supported yet"

and translate_fwd_generic_args (span : Meta.span) (type_infos : type_infos)
(generics : T.generic_args) : generic_args =
Expand Down Expand Up @@ -782,6 +788,8 @@ let rec translate_back_ty (span : Meta.span) (type_infos : type_infos)
else None
| TArrow _ ->
craise __FILE__ __LINE__ span "Arrow types are not supported yet"
| TDynTrait _ ->
craise __FILE__ __LINE__ span "Dynamic trait types are not supported yet"

(** Simply calls [translate_back_ty] *)
let ctx_translate_back_ty (ctx : bs_ctx) (keep_region : 'r -> bool)
Expand Down Expand Up @@ -2306,7 +2314,9 @@ and translate_function_call (call : S.call) (e : S.expression) (ctx : bs_ctx) :
let dest = mk_typed_pattern_from_var dest dest_mplace in
(ctx, Unop (Cast (src_ty, tgt_ty)), effect_info, args, dest)
| CastFnPtr _ ->
craise __FILE__ __LINE__ ctx.span "TODO: function casts")
craise __FILE__ __LINE__ ctx.span "TODO: function casts"
| CastUnsize _ ->
craise __FILE__ __LINE__ ctx.span "TODO: unsize coercions")
| S.Binop binop -> (
match args with
| [ arg0; arg1 ] ->
Expand Down
4 changes: 3 additions & 1 deletion compiler/SynthesizeSymbolic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ let synthesize_symbolic_expansion (span : Meta.span) (sv : symbolic_value)
match ls with
| [ (Some see, exp) ] -> ExpandNoBranch (see, exp)
| _ -> craise __FILE__ __LINE__ span "Ill-formed borrow expansion")
| TVar _ | TLiteral TChar | TNever | TTraitType _ | TArrow _ | TRawPtr _ ->
| TVar _
| TLiteral TChar
| TNever | TTraitType _ | TArrow _ | TRawPtr _ | TDynTrait _ ->
craise __FILE__ __LINE__ span "Ill-formed symbolic expansion"
in
Expansion (place, sv, expansion)
Expand Down
2 changes: 1 addition & 1 deletion compiler/TypesAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ let analyze_full_ty (updated : bool ref) (infos : type_infos)
let rec analyze (expl_info : expl_info) (ty_info : partial_type_info)
(ty : ty) : partial_type_info =
match ty with
| TLiteral _ | TNever | TTraitType _ -> ty_info
| TLiteral _ | TNever | TTraitType _ | TDynTrait _ -> ty_info
| TVar var_id -> (
(* Update the information for the proper parameter, if necessary *)
match ty_info.param_infos with
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 525c5a3

Please sign in to comment.