From 474b9cfa01c0807bbcfcfaea5ee67852e2bec369 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 2 Dec 2022 17:22:59 +0200 Subject: [PATCH] spv/lower: set `FuncParam` attrs to those attached to `OpFunctionParameter`. --- src/spv/lower.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/spv/lower.rs b/src/spv/lower.rs index dbd9f8a..c1c1b74 100644 --- a/src/spv/lower.rs +++ b/src/spv/lower.rs @@ -1014,7 +1014,7 @@ impl Module { } } - let mut params = vec![]; + let mut params = SmallVec::<[_; 8]>::new(); let mut func_def_body = if has_blocks { match &mut func_decl.def { @@ -1471,10 +1471,11 @@ impl Module { ))); } - for (i, (func_type_param, param)) in + for (i, (func_decl_param, param)) in func_decl.params.iter_mut().zip(params).enumerate() { - if func_type_param.ty != param.ty { + func_decl_param.attrs = param.attrs; + if func_decl_param.ty != param.ty { // FIXME(remove) embed IDs in errors by moving them to the // `let invalid = |...| ...;` closure that wraps insts. return Err(invalid(&format!( @@ -1486,7 +1487,7 @@ impl Module { print::Plan::for_root( &cx, &print::ExpectedVsFound { - expected: func_type_param.ty, + expected: func_decl_param.ty, found: param.ty, } )