From 1e9ab7f43a001c5aaa9aad0c4484cc920d6e6748 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 11 Aug 2025 11:43:52 +0200 Subject: [PATCH] compiler/rust: fix errors about hiding elided lifetime In some setups the rust compiler emits errors like the following: ----------------------------------------------------------------------- error: hiding a lifetime that's elided elsewhere is confusing --> ../subprojects/proc-macro2-1.0.86/src/parse.rs:125:25 | 125 | fn block_comment(input: Cursor) -> PResult<&str> { | ^^^^^^ ------------- | | | | | | | the same lifetime is elided here | | the same lifetime is hidden here | the lifetime is hidden here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `-D mismatched-lifetime-syntaxes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(mismatched_lifetime_syntaxes)]` help: use `'_` for type paths | 125 | fn block_comment(input: Cursor<'_>) -> PResult<'_, &str> { | ++++ +++ ----------------------------------------------------------------------- Follow the solution suggested by the compiler to silence the errors, for all the observed occurrences. Reviewed-by: Faith Ekstrand Reviewed-by: Mel Henning Cc: mesa-stable Part-of: (cherry picked from commit 8f84ae7de7897078e9f414518c94f0b068402648) --- .pick_status.json | 2 +- src/compiler/rust/cfg.rs | 4 ++-- src/compiler/rust/nir.rs | 16 ++++++++-------- src/nouveau/compiler/nak/ir.rs | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e263f3297cd..e9fad01a265 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4624,7 +4624,7 @@ "description": "compiler/rust: fix errors about hiding elided lifetime", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/compiler/rust/cfg.rs b/src/compiler/rust/cfg.rs index 6ce34cf348f..38dd7ec0d9d 100644 --- a/src/compiler/rust/cfg.rs +++ b/src/compiler/rust/cfg.rs @@ -266,11 +266,11 @@ impl CFG { self.nodes.get_mut(idx).map(|n| &mut n.node) } - pub fn iter(&self) -> slice::Iter> { + pub fn iter(&self) -> slice::Iter<'_, CFGNode> { self.nodes.iter() } - pub fn iter_mut(&mut self) -> slice::IterMut> { + pub fn iter_mut(&mut self) -> slice::IterMut<'_, CFGNode> { self.nodes.iter_mut() } diff --git a/src/compiler/rust/nir.rs b/src/compiler/rust/nir.rs index d0fdbb4e412..4381bf8b04a 100644 --- a/src/compiler/rust/nir.rs +++ b/src/compiler/rust/nir.rs @@ -406,7 +406,7 @@ impl nir_phi_src { } impl nir_phi_instr { - pub fn iter_srcs(&self) -> ExecListIter { + pub fn iter_srcs(&self) -> ExecListIter<'_, nir_phi_src> { ExecListIter::new(&self.srcs, offset_of!(nir_phi_src, node)) } } @@ -494,7 +494,7 @@ impl nir_instr { } impl nir_block { - pub fn iter_instr_list(&self) -> ExecListIter { + pub fn iter_instr_list(&self) -> ExecListIter<'_, nir_instr> { ExecListIter::new(&self.instr_list, offset_of!(nir_instr, node)) } @@ -529,11 +529,11 @@ impl nir_if { self.iter_else_list().next().unwrap().as_block().unwrap() } - pub fn iter_then_list(&self) -> ExecListIter { + pub fn iter_then_list(&self) -> ExecListIter<'_, nir_cf_node> { ExecListIter::new(&self.then_list, offset_of!(nir_cf_node, node)) } - pub fn iter_else_list(&self) -> ExecListIter { + pub fn iter_else_list(&self) -> ExecListIter<'_, nir_cf_node> { ExecListIter::new(&self.else_list, offset_of!(nir_cf_node, node)) } @@ -543,7 +543,7 @@ impl nir_if { } impl nir_loop { - pub fn iter_body(&self) -> ExecListIter { + pub fn iter_body(&self) -> ExecListIter<'_, nir_cf_node> { ExecListIter::new(&self.body, offset_of!(nir_cf_node, node)) } @@ -599,7 +599,7 @@ impl nir_cf_node { } impl nir_function_impl { - pub fn iter_body(&self) -> ExecListIter { + pub fn iter_body(&self) -> ExecListIter<'_, nir_cf_node> { ExecListIter::new(&self.body, offset_of!(nir_cf_node, node)) } @@ -619,11 +619,11 @@ impl nir_function { } impl nir_shader { - pub fn iter_functions(&self) -> ExecListIter { + pub fn iter_functions(&self) -> ExecListIter<'_, nir_function> { ExecListIter::new(&self.functions, offset_of!(nir_function, node)) } - pub fn iter_variables(&self) -> ExecListIter { + pub fn iter_variables(&self) -> ExecListIter<'_, nir_variable> { ExecListIter::new(&self.variables, offset_of!(nir_variable, node)) } } diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index db56cba0cc0..c9da0a8b26a 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -320,11 +320,11 @@ impl PerRegFile { } } - pub fn values(&self) -> slice::Iter { + pub fn values(&self) -> slice::Iter<'_, T> { self.per_file.iter() } - pub fn values_mut(&mut self) -> slice::IterMut { + pub fn values_mut(&mut self) -> slice::IterMut<'_, T> { self.per_file.iter_mut() } }