summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRyan Lahfa2024-04-17 00:01:34 +0200
committerRyan Lahfa2024-04-24 11:04:11 +0200
commit18484e28ef7b13b95dc3af0b1e34c2181e1778e5 (patch)
treef9480db9b7b00df8a2c4eae43c9705be5b8e2928 /compiler
parentc264b08cfb9beb5fe34d872b02a8f4cd1e12d45e (diff)
compiler: map `core::mem::swap` to the pure swap
In the pure functional model, `swap` is mostly about borrow checking and should simplify to the pure swap in our backends. Other backends than Lean are not done in this commit. Signed-off-by: Ryan Lahfa <ryan.lahfa@inria.fr>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ExtractBuiltin.ml2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/ExtractBuiltin.ml b/compiler/ExtractBuiltin.ml
index 3e96c320..531f1d8b 100644
--- a/compiler/ExtractBuiltin.ml
+++ b/compiler/ExtractBuiltin.ml
@@ -287,6 +287,7 @@ let builtin_funs () : (pattern * bool list option * builtin_fun_info) list =
in
[
mk_fun "core::mem::replace" None None;
+ mk_fun "core::mem::swap" None None;
mk_fun "core::slice::{[@T]}::len"
(Some (backend_choice "slice::len" "Slice::len"))
None;
@@ -517,6 +518,7 @@ let builtin_fun_effects =
"alloc::vec::{alloc::vec::Vec<@T, alloc::alloc::Global>}::new";
"alloc::vec::{alloc::vec::Vec<@T, @A>}::len";
"core::mem::replace";
+ "core::mem::swap";
"core::mem::take";
"core::option::{core::option::Option<@T>}::take";
"core::clone::impls::{core::clone::Clone<bool>}::clone";