Skip to content

differentiate between guesses and suggestions in diagnostic messages #37085

Closed
@oli-obk

Description

@oli-obk

When the compiler or a lint don't have a true solution to the issue they encountered, they can't use a suggestion, because those are supposed to be correct. But some situations (like "name is not defined or in scope") can't possibly know how to correctly fix the issue. I suggest to add another diagnostic called "guess" (the bikeshed may be of any colour).

The regular text-report won't be changed (so guess shows up as help like it does right now). But the json output would contain the guesses for processing by IDEs and tools like rustfix.

This way, suggestions can be automatically applied and guesses require user interaction to apply them.

The json diagnostic structs will be extended this way:

    /// A list of code snippets that could be used to replace the span,
    /// but may contain wrong suggestions. The user needs to take care
    /// to select the correct one or even ignore all of them.
    guesses: Vec<String>,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions