KEMBAR78
Address new lifetime errors in Rust 1.89 by kennykerr · Pull Request #3620 · microsoft/windows-rs · GitHub
Skip to content

Conversation

@kennykerr
Copy link
Collaborator

Recently nightly builds have introduced a new warning for supposedly confusing syntax related to lifetime. I'm not sure its that confusing but this update addresses it nonetheless. Here's an example of such a warning:

error: lifetime flowing from input to output with different syntax can be confusing
  --> crates\libs\metadata\src\reader\tables\constant.rs:21:19
   |
21 |     pub fn parent(&self) -> HasConstant {
   |                   ^^^^^     ----------- the lifetime gets resolved as `'_`
   |                   |
   |                   this lifetime flows to the output
   |
   = note: `-D mismatched-lifetime-syntaxes` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(mismatched_lifetime_syntaxes)]`
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
   |
21 |     pub fn parent(&self) -> HasConstant<'_> {
   |                                        ++++

@kennykerr kennykerr merged commit f8e2899 into master Jun 6, 2025
29 checks passed
@kennykerr kennykerr deleted the warnings branch June 6, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant