From bd6bd4158218c116cbb5a97a1ab8674175cdc773 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Sun, 10 Mar 2024 19:08:08 +0100 Subject: Update the builtin name patterns --- compiler/ExtractBuiltin.ml | 89 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 23 deletions(-) diff --git a/compiler/ExtractBuiltin.ml b/compiler/ExtractBuiltin.ml index 88de31fe..92371afa 100644 --- a/compiler/ExtractBuiltin.ml +++ b/compiler/ExtractBuiltin.ml @@ -253,35 +253,77 @@ let builtin_funs () : (pattern * bool list option * builtin_fun_info) list = (Some [ true; false ]); mk_fun "alloc::vec::{alloc::vec::Vec<@T, @A>}::len" None (Some [ true; false ]); - mk_fun "alloc::vec::{alloc::vec::Vec<@T, @A>}::index" None + mk_fun + "alloc::vec::{core::ops::index::Index, \ + @I>}::index" + (Some "alloc.vec.Vec.index") (Some [ true; true; false ]); - mk_fun "alloc::vec::{alloc::vec::Vec<@T, @A>}::index_mut" None + mk_fun + "alloc::vec::{core::ops::index::IndexMut, \ + @I>}::index_mut" + (Some "alloc.vec.Vec.index_mut") (Some [ true; true; false ]); - mk_fun "alloc::boxed::{Box<@T>}::deref" None (Some [ true; false ]); - mk_fun "alloc::boxed::{Box<@T>}::deref_mut" None (Some [ true; false ]); - mk_fun "core::slice::index::{[@T]}::index" None None; - mk_fun "core::slice::index::{[@T]}::index_mut" None None; - mk_fun "core::array::{[@T; @C]}::index" None None; - mk_fun "core::array::{[@T; @C]}::index_mut" None None; - mk_fun "core::slice::index::{core::ops::range::Range}::get" + mk_fun "alloc::boxed::{core::ops::deref::Deref>}::deref" + (Some "alloc.boxed.Box_deref") + (Some [ true; false ]); + mk_fun "alloc::boxed::{core::ops::deref::DerefMut>}::deref_mut" + (Some "alloc.boxed.Box.deref_mut") + (Some [ true; false ]); + mk_fun "core::slice::index::{core::ops::index::Index<[@T], @I>}::index" + (Some "core.slice.index.Slice.index") None; + mk_fun + "core::slice::index::{core::ops::index::IndexMut<[@T], @I>}::index_mut" + (Some "core.slice.index.Slice.index_mut") None; + mk_fun "core::array::{core::ops::index::Index<[@T; @N], @I>}::index" + (Some "core.array.Array.index") None; + mk_fun "core::array::{core::ops::index::IndexMut<[@T; @N], @I>}::index_mut" + (Some "core.array.Array.index_mut") None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex, \ + [@T]>}::get" (Some "core::slice::index::RangeUsize::get") None; - mk_fun "core::slice::index::{core::ops::range::Range}::get_mut" + mk_fun + "core::slice::index::{core::slice::index::SliceIndex, \ + [@T]>}::get_mut" (Some "core::slice::index::RangeUsize::get_mut") None; - mk_fun "core::slice::index::{core::ops::range::Range}::index" + mk_fun + "core::slice::index::{core::slice::index::SliceIndex, \ + [@T]>}::index" (Some "core::slice::index::RangeUsize::index") None; - mk_fun "core::slice::index::{core::ops::range::Range}::index_mut" + mk_fun + "core::slice::index::{core::slice::index::SliceIndex, \ + [@T]>}::index_mut" (Some "core::slice::index::RangeUsize::index_mut") None; - mk_fun "core::slice::index::{core::ops::range::Range}::get_unchecked" + mk_fun + "core::slice::index::{core::slice::index::SliceIndex, \ + [@T]>}::get_unchecked" (Some "core::slice::index::RangeUsize::get_unchecked") None; mk_fun - "core::slice::index::{core::ops::range::Range}::get_unchecked_mut" + "core::slice::index::{core::slice::index::SliceIndex, \ + [@T]>}::get_unchecked_mut" (Some "core::slice::index::RangeUsize::get_unchecked_mut") None; - mk_fun "core::slice::index::{usize}::get" None None; - mk_fun "core::slice::index::{usize}::get_mut" None None; - mk_fun "core::slice::index::{usize}::get_unchecked" None None; - mk_fun "core::slice::index::{usize}::get_unchecked_mut" None None; - mk_fun "core::slice::index::{usize}::index" None None; - mk_fun "core::slice::index::{usize}::index_mut" None None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex}::get" + None None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex}::get_mut" + None None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex}::get_unchecked" + None None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex}::get_unchecked_mut" + None None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex}::index" + (Some "core_slice_index_Slice_index") None; + mk_fun + "core::slice::index::{core::slice::index::SliceIndex}::index_mut" + (Some "core_slice_index_Slice_index_mut") None; ] let mk_builtin_funs_map () = @@ -351,9 +393,10 @@ let builtin_fun_effects = [ (* TODO: redundancy with the funs information above *) "alloc::vec::{alloc::vec::Vec<@T, @A>}::push"; - "alloc::vec::{alloc::vec::Vec<@T, @A>}::index"; - "alloc::vec::{alloc::vec::Vec<@T, @A>}::index_mut"; - "alloc::vec::{alloc::vec::Vec<@T, @A>}::index_mut_back"; + "alloc::vec::{core::ops::index::Index, \ + @I>}::index"; + "alloc::vec::{core::ops::index::IndexMut, \ + @I>}::index_mut"; ] in let no_state_funs = -- cgit v1.2.3