From 6348eda50ef619992f25e5492c200a39769b9925 Mon Sep 17 00:00:00 2001 From: tmontaigu Date: Fri, 13 Jan 2023 20:18:06 +0100 Subject: [PATCH] fix(rust): properly give an array of location to mlirBlockCreate The MlirBlock constructor expects one location per input argument of the block. --- compiler/lib/Bindings/Rust/src/mlir.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/lib/Bindings/Rust/src/mlir.rs b/compiler/lib/Bindings/Rust/src/mlir.rs index c5fba68a3..3f00c5182 100644 --- a/compiler/lib/Bindings/Rust/src/mlir.rs +++ b/compiler/lib/Bindings/Rust/src/mlir.rs @@ -96,11 +96,14 @@ pub fn create_func_with_block( ) -> MlirOperation { unsafe { // create the main block of the function - let location = mlirLocationUnknownGet(context); + let locations = (0..func_input_types.len()) + .into_iter() + .map(|_| mlirLocationUnknownGet(context)) + .collect::>(); let func_block = mlirBlockCreate( func_input_types.len().try_into().unwrap(), func_input_types.as_ptr(), - &location, + locations.as_ptr(), ); // create region to hold the previously created block