Repository navigation
Tracking Issue for improving suggestion rendering in diagnostics #141973
Description
This is a tracking issue for the prioritizing "verbose" or "hidden" suggestions over "inline" (the default given by span_suggestion suggestions.
Inline suggestions have several issues that make them less readable than verbose ones:
- I've seen people get confused by them
- Small differences caused by typos are much better seen on the verbose output, where the highlighting now points at the exact character, instead of having to visually notice the different text in non-aligned places
- The inline output was the original implementation, but since we've introduced the diff output which is clearer on what we expect the user to write
- For additions, things like "add a type parameter: " are even more unclear
- Relying on the inline suggestions have lead us to use worse spans on purpose because otherwise the rendering would be bad (like skipping whitespace in some cases) and has a tendency to make suggestion mistakes harder to notice (broken suggestions making it in because we couldn't tell during review)
- When a single suggestion is in the diagnostic, the default renders inline, but if there are two, then both get rendered as verbose, which makes the output sometimes sensitive to what was emitted and can cause two similar errors to look very different.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
- Audit all cases of
span_suggestionuses. - Adjust individual cases to be either
span_suggestion_verbose,span_suggestion_hiddenorspan_suggestion_tool_only - Change
span_suggestiontospan_suggestion_inlineandspan_suggestion_verbosetospan_suggestion
Implementation history
- Make some suggestions "verbose" #137343
- Include whitespace in "remove |" suggestion and make it hidden #137872
- Structured suggestion for
extern crate foowhenfooisn't resolved in import #128151 - Fix "missing match arm body" suggestion involving
!#137435 - Fix incorrect
cfgstructured suggestion and make suggestion verbose #137773 - Tweak auto trait errors #137831
- Tweak invalid RTN errors #137824
- Make inline suggestions no longer be the default #127282
- Make typo in field and name suggestions verbose #149816
- Make all multipart suggestions verbose #152596
- Make some parser structured suggestions verbose and tweak their wording #159667
- Use verbose suggestion for parenthetical
Fnnotation and fully-qualified path on ambiguous assoc item #163039 - Tweak "use array's length as const param" suggestion #163040
- Be more explicit on suggestion type without changing how they are rendered #163041
- Use verbose suggestion for wrong primitive type names #163052
- Use verbose suggestion for similarly named label suggestion #163050
- Tweak dyn compatibility error when pointing at receiver #163049
- Do not suggest renaming
let Supertolet super#163048 - Use verbose suggestion for
mut bindinginstead of&mut binding#163047 - Use verbose suggestion for
const _#163046 - Remove redundant output from suggestion #163042
- Use verbose suggestion for method written as function #163054
Activity
compiler-errors commentedon Jun 3, 2025
This work is also enabled by:
which improve the presentation of verbose suggestions when they're "purely additive", which should help reduce the impact of this work.
Rollup merge of rust-lang#142042 - estebank:explicit-lifetime-verbose…
Rollup merge of rust-lang#142043 - estebank:const-suggestion, r=wesle…
Unrolled build for #142043
Rollup merge of #142043 - estebank:const-suggestion, r=wesleywiser
Rollup merge of rust-lang#142045 - estebank:obligation-cause-code-sug…
Rollup merge of rust-lang#142131 - estebank:cast-sugg, r=Urgau
Rollup merge of rust-lang#142045 - estebank:obligation-cause-code-sug…
Rollup merge of rust-lang#142131 - estebank:cast-sugg, r=Urgau
22 remaining items
Unrolled build for #149816
Rollup merge of #149816 - estebank:verbose-typo-suggestion, r=Jonatha…
Rollup merge of #149816 - estebank:verbose-typo-suggestion, r=Jonatha…
Rollup merge of #149816 - estebank:verbose-typo-suggestion, r=Jonatha…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Rollup merge of rust-lang#159667 - estebank:verbose-parse-suggestions…
Unrolled build for #159667
Rollup merge of #159667 - estebank:verbose-parse-suggestions, r=TaKO8Ki
Rollup merge of rust-lang#163039 - estebank:fn-paren-sugg, r=fmease
Unrolled build for #163039 in rollup 163043