diff --git a/CHANGELOG.md b/CHANGELOG.md index f24b1aa1a..40245b55e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,7 @@ Bottom level categories: #### Naga - Fix crash when a texture argument is missing. By @aedm in [#6486](https://github.com/gfx-rs/wgpu/pull/6486) +- Emit an error in constant evaluation, rather than crash, in certain cases where `vecN` constructors have less than N arguments. By @ErichDonGubler in [#6508](https://github.com/gfx-rs/wgpu/pull/6508). #### General diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index 5fdf48151..c12983c0c 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -137,8 +137,8 @@ macro_rules! gen_component_wise_extractor { for idx in 0..(size as u8).into() { let group = component_groups .iter() - .map(|cs| cs[idx]) - .collect::>() + .map(|cs| cs.get(idx).cloned().ok_or(err.clone())) + .collect::, _>>()? .into_inner() .unwrap(); new_components.push($ident(