-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Include rendered diagnostic in json #46052
Conversation
7aa1b0f
to
d5520fc
Compare
Currently checking whether |
Jup, happens on master but not on nightly... edit: it happens with rustc built with debug-assertions. No idea how long we've had this issue, but it's fixed now. |
// generate regular command line output and store it in the json | ||
|
||
// A threadsafe buffer for writing. | ||
#[derive(Default, Clone)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, this is needed only because the interface of EmitterWriter::new
requires it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
src/libsyntax/json.rs
Outdated
@@ -178,7 +200,7 @@ impl Diagnostic { | |||
children: db.children.iter().map(|c| { | |||
Diagnostic::from_sub_diagnostic(c, je) | |||
}).chain(sugg).collect(), | |||
rendered: None, | |||
rendered: Some(output.to_owned()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: unnecessary to_owned
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jup, removed
src/tools/compiletest/src/runtest.rs
Outdated
let mut normalized = output.replace(&parent_dir_str, "$DIR"); | ||
|
||
if json { | ||
normalized = normalized.replace("\\n", "\n"); // verbatim newline in json strings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this in short? This text is going to be used as a whole without any preprocessing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just want this so the json looks readable if suggestions contain multilines. As a side effect error explanations also become readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment explaining what's going on
r=me with questions answered |
8fbb47b
to
3864d89
Compare
@bors r+ |
📌 Commit 3864d89 has been approved by |
Sorry about that, the master branch has an empty line less in the error output with suggestions |
@bors r=petrochenkov |
📌 Commit e7b2702 has been approved by |
…n, r=petrochenkov Include rendered diagnostic in json r? @petrochenkov
Check //~ERROR comments in ui tests r? @nikomatsakis cc #44844 @Phlosioneer @estebank @petrochenkov this depends on #46052 getting merged first (the commits are included in here) The relevant changes of this PR are c2f0af7 and 979269b
Check //~ERROR comments in ui tests r? @nikomatsakis cc #44844 @Phlosioneer @estebank @petrochenkov this depends on #46052 getting merged first (the commits are included in here) The relevant changes of this PR are c2f0af7 and 979269b
r? @petrochenkov