Closure formatting in diagnostics can be a bit verbose
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Consider inputs like https://github.com/rust-lang/rust/blob/278a90913daf7707791020a592d722dd7971f196/tests/ui/closures/closure-clone-requires-captured-clone.rs#L1, the diagnostics is:
The message mentioning the closure uses a format like
LL | let closure = move || {
| ------- within this `{closure@$DIR/closure-clone-requires-captured-clone.rs:13:19: 13:26}`
which feels quite verbose. I guess the span [lo, hi) (in terms of (start, end) line/col) and file path do make it clear which closure is being referred to when there are multiple closures. So not a priority, just tracking this in case there's ways to perhaps make this a bit more concise without losing info -- or assess if that info is actually fully needed).
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 with tests/ui/closures/closure-clone-requires-captured-clone.rs and its corresponding .stderr output to understand the verbose closure location text. Trace where this diagnostic formatting is produced, then determine whether a shorter format can preserve enough location information; done means the intended wording is agreed and the UI output reflects it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100