-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Tracking Issue for improving suggestion rendering in diagnostics #141973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-diagnostics
Working group: Diagnostics
Comments
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. |
This was referenced Jun 4, 2025
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Jun 5, 2025
…-suggestion, r=compiler-errors Make E0621 missing lifetime suggestion verbose ``` error[E0621]: explicit lifetime required in the type of `x` --> $DIR/42701_one_named_and_one_anonymous.rs:10:9 | LL | &*x | ^^^ lifetime `'a` required | help: add explicit lifetime `'a` to the type of `x` | LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 { | ++ ``` Part of rust-lang#141973.
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Jun 6, 2025
…ywiser Verbose suggestion to make param `const` ``` error[E0747]: type provided when a constant was expected --> $DIR/invalid-const-arguments.rs:10:19 | LL | impl<N> Foo for B<N> {} | ^ | help: consider changing this type parameter to a const parameter | LL - impl<N> Foo for B<N> {} LL + impl<const N: u8> Foo for B<N> {} | ``` Part of rust-lang#141973.
rust-timer
added a commit
that referenced
this issue
Jun 7, 2025
Rollup merge of #142043 - estebank:const-suggestion, r=wesleywiser Verbose suggestion to make param `const` ``` error[E0747]: type provided when a constant was expected --> $DIR/invalid-const-arguments.rs:10:19 | LL | impl<N> Foo for B<N> {} | ^ | help: consider changing this type parameter to a const parameter | LL - impl<N> Foo for B<N> {} LL + impl<const N: u8> Foo for B<N> {} | ``` Part of #141973.
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
Jun 7, 2025
Verbose suggestion to make param `const` ``` error[E0747]: type provided when a constant was expected --> $DIR/invalid-const-arguments.rs:10:19 | LL | impl<N> Foo for B<N> {} | ^ | help: consider changing this type parameter to a const parameter | LL - impl<N> Foo for B<N> {} LL + impl<const N: u8> Foo for B<N> {} | ``` Part of rust-lang/rust#141973.
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Jun 7, 2025
…gestion, r=compiler-errors Make obligation cause code suggestions verbose ``` error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:28:10 | LL | e!().await; | ^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - e!().await; LL + e!(); | ``` ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:1:47 | LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5]; | ^^^^ the trait `Copy` is not implemented for `String` | = note: required for `Option<String>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: create an inline `const` block | LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5]; | +++++++ + ``` Part of rust-lang#141973
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Jun 7, 2025
Make cast suggestions verbose ``` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; | ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead | LL - 1u32 as char; LL + char::from_u32(1u32); | ``` ``` error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; | ^^^^^^^^^^^^^ | help: try casting to a reference instead | LL | arr as &[char]; | + ``` ``` error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: you can cast to a `Box` instead | LL | Box::new(1) as Box<dyn Send>; | ++++ + ``` Part of rust-lang#141973.
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Jun 7, 2025
…gestion, r=compiler-errors Make obligation cause code suggestions verbose ``` error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:28:10 | LL | e!().await; | ^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - e!().await; LL + e!(); | ``` ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:1:47 | LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5]; | ^^^^ the trait `Copy` is not implemented for `String` | = note: required for `Option<String>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: create an inline `const` block | LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5]; | +++++++ + ``` Part of rust-lang#141973
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Jun 7, 2025
Make cast suggestions verbose ``` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; | ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead | LL - 1u32 as char; LL + char::from_u32(1u32); | ``` ``` error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; | ^^^^^^^^^^^^^ | help: try casting to a reference instead | LL | arr as &[char]; | + ``` ``` error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: you can cast to a `Box` instead | LL | Box::new(1) as Box<dyn Send>; | ++++ + ``` Part of rust-lang#141973.
rust-timer
added a commit
that referenced
this issue
Jun 7, 2025
Rollup merge of #142131 - estebank:cast-sugg, r=Urgau Make cast suggestions verbose ``` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; | ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead | LL - 1u32 as char; LL + char::from_u32(1u32); | ``` ``` error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; | ^^^^^^^^^^^^^ | help: try casting to a reference instead | LL | arr as &[char]; | + ``` ``` error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: you can cast to a `Box` instead | LL | Box::new(1) as Box<dyn Send>; | ++++ + ``` Part of #141973.
rust-timer
added a commit
that referenced
this issue
Jun 7, 2025
Rollup merge of #142045 - estebank:obligation-cause-code-suggestion, r=compiler-errors Make obligation cause code suggestions verbose ``` error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:28:10 | LL | e!().await; | ^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - e!().await; LL + e!(); | ``` ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:1:47 | LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5]; | ^^^^ the trait `Copy` is not implemented for `String` | = note: required for `Option<String>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: create an inline `const` block | LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5]; | +++++++ + ``` Part of #141973
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-diagnostics
Working group: Diagnostics
Uh oh!
There was an error while loading. Please reload this page.
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:
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
span_suggestion
uses.span_suggestion_verbose
,span_suggestion_hidden
orspan_suggestion_tool_only
span_suggestion
tospan_suggestion_inline
andspan_suggestion_verbose
tospan_suggestion
Implementation history
extern crate foo
whenfoo
isn't resolved in import #128151!
#137435cfg
structured suggestion and make suggestion verbose #137773https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Why.20are.20we.20making.20suggestions.20verbose.3F
The text was updated successfully, but these errors were encountered: