-
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
rustc: Add a warning count upon completion #69926
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
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 feel these should only be emitted if the error count isn't.
For the test you need to run ./x.py test src/test/ui --stage 1 --bless
(you can add --keep-stage 1
after the first time you do that) to update the .stderr
files.
src/librustc_errors/lib.rs
Outdated
self.emit_stashed_diagnostics(); | ||
let s = match self.deduplicated_warn_count { | ||
0 => return, | ||
1 => "build completed with one warning".to_string(), | ||
count => format!("build completed with {} warnings", count), | ||
}; | ||
let _ = self.emit_diagnostic(&Diagnostic::new(Level::Warning, &s)); |
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.
Can't this logic go inside of print_error_count
?
We could even get fancy and emit aborting due to XX previous errors, YY warnings emitted
.
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.
Agreed, that could work.
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.
What would be your preferred way to print it if the build succeeds, but warnings are emitted?
I was thinking about leaving it as it is (warning: build completed with x warnings
or something similar).
Could you squash and rebase onto latest master running @bors rollup=never |
@bors r+ rollup=never |
📌 Commit 6c1f21da58bdcd1171c26e007d264ae1894eaa45 has been approved by |
CC @rust-lang/compiler adding a count for warnings |
src/librustc_errors/lib.rs
Outdated
0 => return, | ||
let warnings = match self.deduplicated_warn_count { | ||
0 => String::new(), | ||
1 => "one warning emitted".to_string(), |
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.
1 => "one warning emitted".to_string(), | |
1 => "1 warning emitted".to_string(), |
@@ -15,6 +15,6 @@ LL | #![plugin(empty_plugin)] | |||
| | |||
= note: `#[warn(deprecated)]` on by default | |||
|
|||
error: aborting due to previous error | |||
error: aborting due to previous error, one warning emitted |
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.
It seems better just to stick with the usual warning, rather than merge it into the error message. The compilation isn't aborting due to the warning at all.
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.
True, but that unnecessary wastes vertical space, which I. keep hearing complaints about.
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.
Maybe we could have error: aborting due to previous error (1 warning emitted)
or error: aborting due to previous error; 1 warning emitted
instead, then. A comma seems inappropriate here.
Sure, what about the change @varkor was talking about regarding errors? |
The |
Waiting on the build. I've also rebased everything onto the most recent changes to master. |
Could you also squash the stderr changes together? (So that there is either one, or two commits: the code change, and the stderr changes.) This helps keep the git commit cleaner, which is convenient when using |
📌 Commit 9f594d2bb0c11d7515dfcf34f7647d041594fa51 has been approved by |
⌛ Testing commit 9f594d2bb0c11d7515dfcf34f7647d041594fa51 with merge d8564429444a927c3d361f296908dec8e34d3d55... |
💔 Test failed - checks-azure |
@bors p=1 |
⌛ Testing commit 2d8a8e2 with merge ba1f7570741b6069079a6e059bf395963fdbb119... |
💔 Test failed - checks-azure |
Failure:
I tried to |
@roccodev: ah, I think you need to include the |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Some tests were introduced today/yesterday; |
@bors r=estebank,varkor rollup=never |
📌 Commit b85c64c has been approved by |
☀️ Test successful - checks-azure |
Tested on commit rust-lang/rust@941d435. Direct link to PR: <rust-lang/rust#69926> 💔 rls on linux: test-pass → test-fail (cc @Xanewok).
Fix nightly test matching rustc "warning" output. rust-lang/rust#69926 changed the warning output from rustc. #8080 attempted to compensate for it, but missed one of the cases. I don't think this test needs to be quite so exhaustive about checking the output.
This adds a
build completed with one warning/x warnings
message, similar to the already presentaborted due to previous error
message.