From 991edde710fbe3405c33a67543130f94ef56f7f8 Mon Sep 17 00:00:00 2001 From: abrown Date: Wed, 1 Jan 2025 20:01:44 -0800 Subject: [PATCH] Update pruner to naga 23 --- src/compose/mod.rs | 2 +- src/compose/tokenizer.rs | 2 +- src/derive.rs | 2 +- src/prune/mod.rs | 9 ++++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/compose/mod.rs b/src/compose/mod.rs index 4e0333f..1299ae3 100644 --- a/src/compose/mod.rs +++ b/src/compose/mod.rs @@ -458,7 +458,7 @@ impl Composer { auto: &'a mut u32, } - impl<'a> regex::Replacer for AutoBindingReplacer<'a> { + impl regex::Replacer for AutoBindingReplacer<'_> { fn replace_append(&mut self, _: ®ex::Captures<'_>, dst: &mut String) { dst.push_str(&format!("@binding({})", self.auto)); *self.auto += 1; diff --git a/src/compose/tokenizer.rs b/src/compose/tokenizer.rs index b57577c..7bd9654 100644 --- a/src/compose/tokenizer.rs +++ b/src/compose/tokenizer.rs @@ -7,7 +7,7 @@ pub enum Token<'a> { Whitespace(&'a str, usize), } -impl<'a> Token<'a> { +impl Token<'_> { pub fn pos(&self) -> usize { match self { Token::Identifier(_, pos) | Token::Other(_, pos) | Token::Whitespace(_, pos) => *pos, diff --git a/src/derive.rs b/src/derive.rs index 8aeef3e..d79a1be 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -829,7 +829,7 @@ impl<'a> DerivedModule<'a> { } } -impl<'a> From> for naga::Module { +impl From> for naga::Module { fn from(derived: DerivedModule) -> Self { naga::Module { types: derived.types, diff --git a/src/prune/mod.rs b/src/prune/mod.rs index 94c5bd8..762c8ff 100644 --- a/src/prune/mod.rs +++ b/src/prune/mod.rs @@ -450,7 +450,7 @@ impl FunctionReq { pointer: expr_map[pointer], fun: *fun, value: expr_map[value], - result: expr_map[result], + result: result.as_ref().map(|it| expr_map[it]), }) } ( @@ -1568,12 +1568,15 @@ impl<'a> Pruner<'a> { let required_store = self.store_required(context, &var_ref); debug!("atomic store required: {:?}", required_store); - let required_load = func_req.exprs_required.get(result).cloned(); + let required_load = match result { + Some(result) => func_req.exprs_required.get(result).cloned(), + None => None, + }; debug!("atomic load required: {:?}", required_load); if required_load.is_some() || required_store.is_some() { // just pass it all through i guess ..? - if let Some(required_load) = required_load { + if let (Some(required_load), Some(result)) = (required_load, result) { self.add_expression(function, func_req, context, *result, &required_load); } if let Some(required_store) = required_store {