fix(const_eval): don't panic when a vecN constructor's arg. count is less than N (#6508)

This commit is contained in:
Erich Gubler 2024-11-12 07:44:02 -05:00 committed by GitHub
parent cffc7933fd
commit 5e68a63151
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -72,6 +72,7 @@ Bottom level categories:
#### Naga #### Naga
- Fix crash when a texture argument is missing. By @aedm in [#6486](https://github.com/gfx-rs/wgpu/pull/6486) - 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 #### General

View File

@ -137,8 +137,8 @@ macro_rules! gen_component_wise_extractor {
for idx in 0..(size as u8).into() { for idx in 0..(size as u8).into() {
let group = component_groups let group = component_groups
.iter() .iter()
.map(|cs| cs[idx]) .map(|cs| cs.get(idx).cloned().ok_or(err.clone()))
.collect::<ArrayVec<_, N>>() .collect::<Result<ArrayVec<_, N>, _>>()?
.into_inner() .into_inner()
.unwrap(); .unwrap();
new_components.push($ident( new_components.push($ident(