diff --git a/Cargo.lock b/Cargo.lock index a024989dc..16ca4b9ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -649,6 +649,7 @@ dependencies = [ "once_cell", "salsa", "smol_str", + "toml", ] [[package]] @@ -873,9 +874,9 @@ dependencies = [ [[package]] name = "cairo-lang-test-utils" -version = "2.5.4" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ab221aa0119b6e613992127687a1352a896d30a2e55a9295c52eb9598bcc78" +checksum = "aa2891a07af4e55a029be8ad2ec88558fe6e78d6afd67f8c1308e99676586d3a" dependencies = [ "cairo-lang-utils", "colored", diff --git a/src/compiler.rs b/src/compiler.rs index 30a2ca04b..e2c954308 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -159,7 +159,7 @@ fn compile_func( metadata, ) .collect::, _>>()?; - let mut ret_types = extract_types( + let mut return_types = extract_types( context, module, &function.signature.ret_types, @@ -186,9 +186,9 @@ fn compile_func( } } - // Extract memory-allocated return types from ret_types and insert them in arg_types as a + // Extract memory-allocated return types from return_types and insert them in arg_types as a // pointer. - let return_types = function + let return_type_infos = function .signature .ret_types .iter() @@ -205,15 +205,15 @@ fn compile_func( // None => Doesn't return anything. // Some(false) => Has a complex return type. // Some(true) => Has a manual return type which is in `arg_types[0]`. - let has_return_ptr = if return_types.len() > 1 { + let has_return_ptr = if return_type_infos.len() > 1 { Some(false) - } else if return_types + } else if return_type_infos .first() .is_some_and(|(_, type_info)| type_info.is_memory_allocated(registry)) { - assert_eq!(ret_types.len(), 1); + assert_eq!(return_types.len(), 1); - ret_types.remove(0); + return_types.remove(0); arg_types.insert(0, llvm::r#type::opaque_pointer(context)); Some(true) @@ -576,7 +576,7 @@ fn compile_func( // Store the return value in the return pointer, if there's one. if let Some(true) = has_return_ptr { - let (_ret_type_id, ret_type_info) = return_types[0]; + let (_ret_type_id, ret_type_info) = return_type_infos[0]; let ret_layout = ret_type_info.layout(registry)?; let ptr = values.remove(0); @@ -658,7 +658,7 @@ fn compile_func( module.body().append_operation(func::func( context, StringAttribute::new(context, &function_name), - TypeAttribute::new(FunctionType::new(context, &arg_types, &ret_types).into()), + TypeAttribute::new(FunctionType::new(context, &arg_types, &return_types).into()), region, &[ (