Skip to content

Commit

Permalink
spv/lower: set FuncParam attrs to those attached to `OpFunctionPara…
Browse files Browse the repository at this point in the history
…meter`. (#12)

Looks like an accidental omission originally - found while trying to
align `rustc_codegen_spirv::linker::test` unit tests so SPIR-T doesn't
affect them (for
EmbarkStudios/rust-gpu#940 (comment)).
  • Loading branch information
eddyb authored Dec 9, 2022
2 parents b586de4 + 474b9cf commit b050a10
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/spv/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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!(
Expand All @@ -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,
}
)
Expand Down

0 comments on commit b050a10

Please sign in to comment.