Misleading error message for remove explicit elided lifetime
Open
Nobody has claimed this yet.
A-diagnostics
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
This branch has a compile error: https://github.com/UkoeHB/bevy_cobweb_ui/tree/elided_lifetime
Current output
return type references an anonymous lifetime, which is not constrained by the fn input types
lifetimes appearing in an associated or opaque type are not considered constrained
consider introducing a named lifetime parameter
Desired output
It should point to the `Reader<'_>` and tell me to remove `<'_>`.
Rationale and extra context
This is the Bevy PR that caused the issue: https://github.com/bevyengine/bevy/pull/14082 . See https://github.com/bevyengine/bevy/pull/14082#issuecomment-2219546976 .
The only change relevant here was &mut Reader -> &mut dyn Reader.
Other cases
No response
Rust Version
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: aarch64-apple-darwin
release: 1.79.0
LLVM version: 18.1.7
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the compile error from the linked elided_lifetime branch with rustc 1.79.0, then trace the diagnostic for the Reader<'_> return type. Compare the emitted span and suggestion with the desired output; done means the diagnostic points to Reader<'_> and recommends removing <'_>.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100