Skip to content

Error Message Overhaul #33240

Closed
Closed
@nikomatsakis

Description

@nikomatsakis

PR #32756 began a gradual overhaul of our error message formatting. We would very much like feedback on error messages you think could use improvement, as well of course as any bugs or other problems with the new error formatting code. Please leave comments!

What follows is a list of known issues we plan to address. Likely many of these will be moved into distinct GitHub issues at some point.

Improvements to the overall error reporting mechanism:

  • New unit testing mechanism that can test colors and precise appearance: Add UI testing to compiler test suite #33000
  • Improve the treatment of tabs.
  • Subdiagnostics like note should not be colored green but rather just appear bold
  • Subdiagnostics like note should not use the --> indicator but rather >>>, and the underline should be -- and not ^^
    • basically, they do not have a primary span
  • Mandatory labels on primary spans?
  • Change from >>>> for secondary file names to something like ::: maybe?
  • When snippet labels are too long, potentially move them to a footnote of some kind

Specific error messages that need improvement:

  • Identify when you have the same span for multiple borrows in a loop and give a better message.
  • We special case closure captures due to unique loans, but we could give similar treatment to any loan coming through a capture.
  • Decide whether to thread the closure header span through the builder API convenience methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions