Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<Registers: RegisterAllocator> BrilligBlock<'_, Registers> {
if data.is_empty() {
return;
}
let item_types = typ.clone().element_types();
let item_types = typ.element_types();

// Find out if we are repeating the same item over and over
let first_item = data.iter().take(item_types.len()).copied().collect();
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ impl<'ssa, W: Write> Interpreter<'ssa, W> {
let is_slice = matches!(&result_type, Type::Slice(..));

// The number of elements in the array must be a multiple of the number of element types
let element_types = result_type.clone().element_types();
let element_types = result_type.element_types();
if element_types.is_empty() {
if !elements.is_empty() {
return Err(internal(InternalError::MakeArrayElementCountMismatch {
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_evaluator/src/ssa/ir/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Type {
/// to represent the type. This is 1 for every primitive type, and is the number of fields
/// for any flattened tuple type.
///
/// Equivalent to `self.element_types().len()`, but doesn't consume the `self`.
/// Equivalent to `self.element_types().len()`.
///
/// Panics if `self` is not a [`Type::Array`] or [`Type::Slice`].
pub(crate) fn element_size(&self) -> usize {
Expand All @@ -234,9 +234,9 @@ impl Type {
/// Return the types of items in this array/slice.
///
/// Panics if `self` is not a [`Type::Array`] or [`Type::Slice`].
pub(crate) fn element_types(self) -> Arc<Vec<Type>> {
pub(crate) fn element_types(&self) -> Arc<Vec<Type>> {
match self {
Type::Array(element_types, _) | Type::Slice(element_types) => element_types,
Type::Array(element_types, _) | Type::Slice(element_types) => element_types.clone(),
other => panic!("element_types: Expected array or slice, found {other}"),
}
}
Expand Down
Loading