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

Put back ui json check #48684

Merged
merged 2 commits into from
Mar 14, 2018
Merged

Conversation

GuillaumeGomez
Copy link
Member

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 2, 2018
.iter()
.any(|s| s.starts_with("--error-format"))
{
rustc.args(&["--error-format", "json"]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Zui-testing was lost during revert.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work at all. Whatever I try to do, I always end with empty stderr so I'll keep my code for the moment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nevermind, I didn't update correctly...

@petrochenkov
Copy link
Contributor

Could you split this into revert commits for 9b597a1 and 1dc2015 and commit with actual new implementation?

Also UI test outputs need to be regenerated.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 3, 2018
@zackmdavis
Copy link
Member

-Zui-testing was lost during revert. [...] split this into revert commits for 9b597a1 and 1dc2015

@GuillaumeGomez I think I got the restoration of -Zui-testing right in #48621?—in case you would rather cherry-pick those commits rather than re-authoring similar commits from scratch yourself. (git revert 9b597a1 and git revert 1dc2015 both result in conflicts that need to be fixed manually.)

@@ -31,6 +31,11 @@ const ANONYMIZED_LINE_NUM: &str = "LL";
pub trait Emitter {
/// Emit a structured diagnostic.
fn emit(&mut self, db: &DiagnosticBuilder);

/// Shows explanation about "rustc --explain"
fn show_explain(&mut self) -> Vec<String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this does successfully implement #48041, it seems rather ad hoc to make a show_explain method be part of the contract of the Emitter trait. (In contrast to how it makes sense for all Emitters to have an emit method, because that's what being an Emitter is all about.) Can we implement this in a more generalizable way?

Two potential alternatives that come to mind:

  • Make the Emitter trait have a destination method that exposes something we can write arbitrary lines to, and use it to write the --explain usage message in abort_if_errors.
    • JsonEmitter's dst field is of type Box<Write + Send>, and EmitterWriter's Destination implements Write and the field of all three of its variants implement Send (visible in the source in the case of BufferedTerminal and Raw, and the term docs say that StderrTerminal is Send), so I think the types should check out.
  • Implement the --explain message as a Diagnostic, adding a plainer formatting mode to Diagnostic if necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeGomez can you comment on this?

@@ -41,6 +42,7 @@ pub struct JsonEmitter {
/// Whether "approximate suggestions" are enabled in the config
approximate_suggestions: bool,
ui_testing: bool,
error_codes: HashSet<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in passing at the end of a previous comment, Handler already knows what what codes we've emitted; JsonEmitter shouldn't have to know this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh indeed. I'll remove this add.

error_codes[..limit].join(", "),
if error_codes.len() > 9 { "..." } else { "" }),
format!("If you want more information on an error, try using \
\"rustc --explain {}\"",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(If we end up needing to regenerate the UI test expectations anyway in the course of this PR, then we might as well also update the language (and use backticks) at the same time; but if not, then we can continue leave those tasks to #48559.)

@bors
Copy link
Contributor

bors commented Mar 3, 2018

☔ The latest upstream changes (presumably #48586) made this pull request unmergeable. Please resolve the merge conflicts.

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 3, 2018
@GuillaumeGomez
Copy link
Member Author

@petrochenkov: Reverting seems like way too much troubles...

@GuillaumeGomez GuillaumeGomez force-pushed the put-back-ui-json-check branch 5 times, most recently from d61877f to 1975eb4 Compare March 3, 2018 15:58
@GuillaumeGomez
Copy link
Member Author

This new way of handling things will certainly please you more. :)

@bors
Copy link
Contributor

bors commented Mar 4, 2018

☔ The latest upstream changes (presumably #48125) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2018
@GuillaumeGomez GuillaumeGomez force-pushed the put-back-ui-json-check branch 2 times, most recently from 7c371ad to 8a6f0a2 Compare March 4, 2018 14:11
@bors
Copy link
Contributor

bors commented Mar 4, 2018

☔ The latest upstream changes (presumably #47832) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez GuillaumeGomez force-pushed the put-back-ui-json-check branch 2 times, most recently from bcf99f3 to ef6dbb1 Compare March 4, 2018 21:02
@GuillaumeGomez GuillaumeGomez force-pushed the put-back-ui-json-check branch 2 times, most recently from 46dc072 to 5a48d31 Compare March 12, 2018 23:33
@GuillaumeGomez
Copy link
Member Author

@petrochenkov: Tests (finally) passed.

Some errors occurred: E0191, E0221.

For more information about an error, try `rustc --explain E0191`.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing: removing this trailing empty line and the empty line after "Some errors occurred...", then we'll land this with higher priority.

@GuillaumeGomez
Copy link
Member Author

@petrochenkov: Done as well, but let's wait for CI confirmation first.

@GuillaumeGomez GuillaumeGomez force-pushed the put-back-ui-json-check branch 2 times, most recently from 43bda9a to 6c673ef Compare March 13, 2018 20:27
@GuillaumeGomez
Copy link
Member Author

@petrochenkov: New tests are being added all the time. T_T

@petrochenkov
Copy link
Contributor

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Mar 14, 2018

📌 Commit 2e104a7 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 14, 2018
@bors
Copy link
Contributor

bors commented Mar 14, 2018

⌛ Testing commit 2e104a7 with merge fab632f...

bors added a commit that referenced this pull request Mar 14, 2018
@bors
Copy link
Contributor

bors commented Mar 14, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: petrochenkov
Pushing fab632f to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants