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 <faith.ekstrand@collabora.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36849>
(cherry picked from commit 8f84ae7de7)
This commit is contained in:
Antonio Ospite 2025-08-11 11:43:52 +02:00 committed by Eric Engestrom
parent 36f3c9c422
commit 1e9ab7f43a
4 changed files with 13 additions and 13 deletions

View file

@ -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

View file

@ -266,11 +266,11 @@ impl<N> CFG<N> {
self.nodes.get_mut(idx).map(|n| &mut n.node)
}
pub fn iter(&self) -> slice::Iter<CFGNode<N>> {
pub fn iter(&self) -> slice::Iter<'_, CFGNode<N>> {
self.nodes.iter()
}
pub fn iter_mut(&mut self) -> slice::IterMut<CFGNode<N>> {
pub fn iter_mut(&mut self) -> slice::IterMut<'_, CFGNode<N>> {
self.nodes.iter_mut()
}

View file

@ -406,7 +406,7 @@ impl nir_phi_src {
}
impl nir_phi_instr {
pub fn iter_srcs(&self) -> ExecListIter<nir_phi_src> {
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<nir_instr> {
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<nir_cf_node> {
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<nir_cf_node> {
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<nir_cf_node> {
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<nir_cf_node> {
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<nir_function> {
pub fn iter_functions(&self) -> ExecListIter<'_, nir_function> {
ExecListIter::new(&self.functions, offset_of!(nir_function, node))
}
pub fn iter_variables(&self) -> ExecListIter<nir_variable> {
pub fn iter_variables(&self) -> ExecListIter<'_, nir_variable> {
ExecListIter::new(&self.variables, offset_of!(nir_variable, node))
}
}

View file

@ -320,11 +320,11 @@ impl<T> PerRegFile<T> {
}
}
pub fn values(&self) -> slice::Iter<T> {
pub fn values(&self) -> slice::Iter<'_, T> {
self.per_file.iter()
}
pub fn values_mut(&mut self) -> slice::IterMut<T> {
pub fn values_mut(&mut self) -> slice::IterMut<'_, T> {
self.per_file.iter_mut()
}
}