Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update charon #311

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
3a56d3a39ad19db2377fa2dc712b73ebe291beb6
9e782beeb099f447661ce91da9ba1181a94642fe
8 changes: 1 addition & 7 deletions compiler/ExtractBase.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2095,13 +2095,7 @@ let ctx_compute_fun_name (def : fun_decl) (ctx : extraction_ctx) : string =
| None -> def.item_meta
| Some trait_decl -> (
let methods =
trait_decl.required_methods
@ List.filter_map
(fun (name, opt_id) ->
match opt_id with
| None -> None
| Some id -> Some (name, id))
trait_decl.provided_methods
trait_decl.required_methods @ trait_decl.provided_methods
in
match
List.find_opt (fun (name, _) -> name = item_name) methods
Expand Down
12 changes: 2 additions & 10 deletions compiler/InterpreterStatements.ml
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,6 @@ let eval_transparent_function_call_symbolic_inst (span : Meta.span)
(fun (s, _) -> s = method_name)
trait_decl.provided_methods
in
let method_id = Option.get method_id in
let method_def = ctx_lookup_fun_decl ctx method_id in
(* For the instantiation we have to do something peculiar
because the method was defined for the trait declaration.
Expand Down Expand Up @@ -863,17 +862,10 @@ let eval_transparent_function_call_symbolic_inst (span : Meta.span)
in
(* Lookup the method decl in the required *and* the provided methods *)
let _, method_id =
let provided =
List.filter_map
(fun (id, f) ->
match f with
| None -> None
| Some f -> Some (id, f))
trait_decl.provided_methods
in
List.find
(fun (s, _) -> s = method_name)
(List.append trait_decl.required_methods provided)
(List.append trait_decl.required_methods
trait_decl.provided_methods)
in
let method_def = ctx_lookup_fun_decl ctx method_id in
log#ldebug
Expand Down
2 changes: 1 addition & 1 deletion compiler/Pure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ type trait_decl = {
consts : (trait_item_name * ty) list;
types : trait_item_name list;
required_methods : (trait_item_name * fun_decl_id) list;
provided_methods : (trait_item_name * fun_decl_id option) list;
provided_methods : (trait_item_name * fun_decl_id) list;
}
[@@deriving show]

Expand Down
2 changes: 1 addition & 1 deletion compiler/PureUtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ let trait_decl_get_method (trait_decl : trait_decl) (method_name : string) :
let _, id =
List.find (fun (s, _) -> s = method_name) trait_decl.provided_methods
in
{ is_provided = true; id = Option.get id }
{ is_provided = true; id }

let trait_decl_is_empty (trait_decl : trait_decl) : bool =
let {
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.

8 changes: 8 additions & 0 deletions tests/coq/misc/External_FunsExternal_Template.v
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ Axiom core_cell_Cell_get_mut :
result (state * (core_cell_Cell_t T)))))
.

(** [core::clone::Clone::clone_from]:
Source: '/rustc/library/core/src/clone.rs', lines 175:4-175:43
Name pattern: core::clone::Clone::clone_from *)
Axiom core_clone_Clone_clone_from :
forall{Self : Type} (self_clause : core_clone_Clone Self),
Self -> Self -> state -> result (state * Self)
.

End External_FunsExternal_Template.
7 changes: 7 additions & 0 deletions tests/fstar/misc/External.FunsExternal.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ val core_cell_Cell_get_mut
core_cell_Cell_t t -> state -> result (state & (t & (t -> state -> result
(state & (core_cell_Cell_t t)))))

(** [core::clone::Clone::clone_from]:
Source: '/rustc/library/core/src/clone.rs', lines 175:4-175:43
Name pattern: core::clone::Clone::clone_from *)
val core_clone_Clone_clone_from
(#self : Type0) (self_clause : core_clone_Clone self) :
self -> self -> state -> result (state & self)

7 changes: 7 additions & 0 deletions tests/lean/External/FunsExternal_Template.lean
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ axiom core.cell.Cell.get_mut
core.cell.Cell T → State → Result (State × (T × (T → State → Result
(State × (core.cell.Cell T)))))

/- [core::clone::Clone::clone_from]:
Source: '/rustc/library/core/src/clone.rs', lines 175:4-175:43
Name pattern: core::clone::Clone::clone_from -/
axiom core.clone.Clone.clone_from
{Self : Type} (self_clause : core.clone.Clone Self) :
Self → Self → State → Result (State × Self)

7 changes: 7 additions & 0 deletions tests/lean/Tutorial/Tutorial.lean
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,11 @@ def add
let x1 ← alloc.vec.Vec.resize U32 core.clone.CloneU32 x max1 0#u32
add_loop x1 y max1 0#u8 0#usize

/- [core::clone::Clone::clone_from]:
Source: '/rustc/library/core/src/clone.rs', lines 175:4-175:43
Name pattern: core::clone::Clone::clone_from -/
axiom core.clone.Clone.clone_from
{Self : Type} (self_clause : core.clone.Clone Self) :
Self → Self → Result Self

end tutorial
Loading