diff --git a/third_party/move/move-core/types/src/function.rs b/third_party/move/move-core/types/src/function.rs index aba217289b5c73..d3dabeff8f9820 100644 --- a/third_party/move/move-core/types/src/function.rs +++ b/third_party/move/move-core/types/src/function.rs @@ -25,6 +25,11 @@ impl fmt::Display for ClosureMask { } impl ClosureMask { + /// The maximal number of arguments which can be handled by a closure mask. + /// A captured argument's position in the argument list must be lower than + /// this number. Notice that this property is implicit in the bytecode: + /// a PACK_CLOSURE instruction will never pop more arguments from the + /// stack than this number. pub const MAX_ARGS: usize = 64; pub fn new(mask: u64) -> Self { @@ -38,10 +43,14 @@ impl ClosureMask { /// Apply a closure mask to a list of elements, returning only those /// where position `i` is set in the mask (if `collect_captured` is true) or not /// set (otherwise). - pub fn extract<'a, T>(&self, values: &'a [T], collect_captured: bool) -> Vec<&'a T> { + pub fn extract<'a, T>( + &self, + values: impl IntoIterator, + collect_captured: bool, + ) -> Vec<&'a T> { let mut mask = self.0; values - .iter() + .into_iter() .filter(|_| { let set = mask & 0x1 != 0; mask >>= 1; diff --git a/third_party/move/move-vm/runtime/src/storage/ty_tag_cache.rs b/third_party/move/move-vm/runtime/src/storage/ty_tag_cache.rs index c6b70e8edbc584..e77c0d3cab25c9 100644 --- a/third_party/move/move-vm/runtime/src/storage/ty_tag_cache.rs +++ b/third_party/move/move-vm/runtime/src/storage/ty_tag_cache.rs @@ -225,9 +225,10 @@ mod tests { use super::*; use crate::config::VMConfig; use claims::{assert_err, assert_none, assert_ok, assert_ok_eq, assert_some}; - use move_binary_format::file_format::{AbilitySet, StructTypeParameter}; + use move_binary_format::file_format::StructTypeParameter; use move_core_types::{ - account_address::AccountAddress, identifier::Identifier, language_storage::ModuleId, + ability::AbilitySet, account_address::AccountAddress, identifier::Identifier, + language_storage::ModuleId, }; use move_vm_types::loaded_data::runtime_types::{ AbilityInfo, StructIdentifier, StructLayout, StructType, TypeBuilder,