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

FailureNote JSON value is not useful #60425

Closed
ehuss opened this issue Apr 30, 2019 · 2 comments · Fixed by #64429
Closed

FailureNote JSON value is not useful #60425

ehuss opened this issue Apr 30, 2019 · 2 comments · Fixed by #64429
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Apr 30, 2019

Currently the FailureNote diagnostic level serializes to the empty string. This results in JSON messages containing level: "", which I'm not sure how to interpret.

This was added in #48684, though reading that PR I can't really figure out why it was added and how it relates to compiletest changes.

An easy way to see this is to trigger a diagnostic that prints "For more information…", for example:

// E0005
let Some(_y) = Some(1);

will emit a JSON value like this:

{
  "message": "For more information about this error, try `rustc --explain E0005`.",
  "code": null,
  "level": "",
  "spans": [],
  "children": [],
  "rendered": "For more information about this error, try `rustc --explain E0005`.\n"
}

The empty string is not very descriptive of how to handle the message. I would suggest having it serialize to something more deliberate, such as "failure-note". I can't really tell what the intent of FailureNote is, so it's hard to say what it should be.

cc @GuillaumeGomez who might know more.

@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 30, 2019
@GuillaumeGomez
Copy link
Member

Serialising as "failure-note" sounds good to me. Weird we didn't do it beforehand...

@Mark-Simulacrum Mark-Simulacrum added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Sep 11, 2019
@afnanenayet
Copy link
Contributor

I'd like to pick this up

tmandry added a commit to tmandry/rust that referenced this issue Sep 17, 2019
…json-level, r=Mark-Simulacrum

Fix failure note `to_str` implementation

Serialize the level to something a little more useful for a failure note struct. This fixes rust-lang#60425.
tmandry added a commit to tmandry/rust that referenced this issue Sep 17, 2019
…json-level, r=Mark-Simulacrum

Fix failure note `to_str` implementation

Serialize the level to something a little more useful for a failure note struct. This fixes rust-lang#60425.
@bors bors closed this as completed in ffee7bb Sep 18, 2019
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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants