rust-lang / rust-lang/rust-analyzer
TypeMismatch closure display style
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
fn foo() -> Option<impl Fn() -> i32> {
Some(|| {})
}
Outputs diagnostic: expected Option<impl Fn() -> i32>, found Option<{closure#153601}>
Expect diagnostic: expected Option<impl Fn() -> i32>, found Option<impl Fn()>
But could this cause confusion? Perhaps similar to #22331
And this may be configurable, but currently only the configuration of inlayhints is available, I don't know if it needs to be reused
rust-analyzer 0.4.2897-standalone
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
Start by reproducing the TypeMismatch diagnostic with the Rust snippet in the issue, then trace the rust-analyzer diagnostic rendering path for closure types. Compare the current and expected display, and determine whether configuration should reuse the existing inlay-hint configuration. Done means the diagnostic uses the agreed closure display without introducing confusing output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100