Skip to content
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

🔤 optional human-readable summary/title? #116

Closed
favonia opened this issue Oct 22, 2023 · 1 comment
Closed

🔤 optional human-readable summary/title? #116

favonia opened this issue Oct 22, 2023 · 1 comment

Comments

@favonia
Copy link
Contributor

favonia commented Oct 22, 2023

To improve interoperability with Rust-style error messages, I proposed adding an optional title or summary.

Reporter API changes:

  • A diagnostic will carry an optional title/summary field.
  • For structured reporters, a user has to define a new function default_title/default_summary.
  • For both structured and free-form reporters, there will be an optional title/summary argument when appropriate.

Handler changes:

  • In TTY, the summary will follow error[code] as error[code]: summary.
  • In LSP, the summary will prefix the main message, such as summary: explanation.

I don't know whether summary or title is better. I'm leaning towards summary.

@favonia favonia added help wanted Extra attention is needed question Further information is requested and removed help wanted Extra attention is needed question Further information is requested labels Oct 22, 2023
@favonia
Copy link
Contributor Author

favonia commented Oct 22, 2023

After checking real error messages from the Rust compiler, I feel more negative about this idea. For example, it seems sometimes it's a duplication of the (primary) label:

error[E0277]: `()` is not an iterator
  --> $DIR/conservative_impl_trait.rs:3:33
   |
LL | fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
   |
   = help: the trait `Iterator` is not implemented for `()`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.

and very often the text on the primary label is missing:

error: `#[doc(alias("a"))]` expects string literals
  --> $DIR/check-doc-alias-attr.rs:19:13
   |
LL | #[doc(alias(0))]
   |             ^

In either case, they could have just put the full text on the primary label and omit the main message (as we did in asai). I therefore think it's not really useful. I also have not heard any strong support of this feature yet. Closing this as "not planned" until someone complains.

@favonia favonia closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant