summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRyan Lahfa2024-04-16 23:30:47 +0200
committerRyan Lahfa2024-04-17 00:31:44 +0200
commitc264b08cfb9beb5fe34d872b02a8f4cd1e12d45e (patch)
tree1b0188215788a8ec27120a8e854283ed49c1b9b7 /compiler
parent23da71768c03d955c916635bfc5c9d5806a80187 (diff)
compiler: map `core::option::Option::take` to identity function
`take` in a pure functional model is the identity function and everything related to borrow checking is handled by the forward/backward mechanism. Signed-off-by: Ryan Lahfa <ryan.lahfa@inria.fr>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ExtractBuiltin.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/ExtractBuiltin.ml b/compiler/ExtractBuiltin.ml
index a9b939b5..3e96c320 100644
--- a/compiler/ExtractBuiltin.ml
+++ b/compiler/ExtractBuiltin.ml
@@ -290,6 +290,9 @@ let builtin_funs () : (pattern * bool list option * builtin_fun_info) list =
mk_fun "core::slice::{[@T]}::len"
(Some (backend_choice "slice::len" "Slice::len"))
None;
+ mk_fun "core::option::{core::option::Option<@T>}::take"
+ (Some (backend_choice "option::take" "Option::take"))
+ None;
mk_fun "alloc::vec::{alloc::vec::Vec<@T, alloc::alloc::Global>}::new"
(Some "alloc::vec::Vec::new") None;
mk_fun "alloc::vec::{alloc::vec::Vec<@T, @A>}::push" None
@@ -515,6 +518,7 @@ let builtin_fun_effects =
"alloc::vec::{alloc::vec::Vec<@T, @A>}::len";
"core::mem::replace";
"core::mem::take";
+ "core::option::{core::option::Option<@T>}::take";
"core::clone::impls::{core::clone::Clone<bool>}::clone";
"alloc::vec::{alloc::vec::Vec<@T, alloc::alloc::Global>}::with_capacity";
"core::slice::{[@T]}::reverse";