diff --git a/CHANGELOG.md b/CHANGELOG.md index 95581d9cf8..e8cb94ed37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,6 +133,7 @@ By @cwfitzgerald in [#7030](https://github.com/gfx-rs/wgpu/pull/7030). - Support @must_use attribute on function declarations. By @turbocrime in [#6801](https://github.com/gfx-rs/wgpu/pull/6801). - Support for generating the candidate intersections from AABB geometry, and confirming the hits. By @kvark in [#7047](https://github.com/gfx-rs/wgpu/pull/7047). - Make naga::back::spv::Function::to_words write the OpFunctionEnd instruction in itself, instead of making another call after it. By @junjunjd in [#7156](https://github.com/gfx-rs/wgpu/pull/7156). +- Use take method for Arena to avoid unnecessary cloning. By @junjunjd in [#7176](https://github.com/gfx-rs/wgpu/pull/7176). ### Changes diff --git a/naga/src/front/wgsl/lower/mod.rs b/naga/src/front/wgsl/lower/mod.rs index 7cd3ef90f8..72aeabeb53 100644 --- a/naga/src/front/wgsl/lower/mod.rs +++ b/naga/src/front/wgsl/lower/mod.rs @@ -1040,10 +1040,10 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { pub fn lower( &mut self, - tu: &'temp ast::TranslationUnit<'source>, + tu: &'temp mut ast::TranslationUnit<'source>, ) -> Result> { let mut module = crate::Module { - diagnostic_filters: tu.diagnostic_filters.clone(), + diagnostic_filters: std::mem::take(&mut tu.diagnostic_filters), diagnostic_filter_leaf: tu.diagnostic_filter_leaf, ..Default::default() }; diff --git a/naga/src/front/wgsl/mod.rs b/naga/src/front/wgsl/mod.rs index 7c7c0ba88f..bc1a51d17a 100644 --- a/naga/src/front/wgsl/mod.rs +++ b/naga/src/front/wgsl/mod.rs @@ -40,9 +40,9 @@ impl Frontend { } fn inner<'a>(&mut self, source: &'a str) -> Result> { - let tu = self.parser.parse(source)?; + let mut tu = self.parser.parse(source)?; let index = index::Index::generate(&tu)?; - let module = Lowerer::new(&index).lower(&tu)?; + let module = Lowerer::new(&index).lower(&mut tu)?; Ok(module) }