-
Notifications
You must be signed in to change notification settings - Fork 906
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
cargo test fails with rustc 1.24.0-nightly (0a3761e63 2018-01-03)
#2338
Comments
I've been looking at this just now - I think it is caused by the error recovery mechanism in the parser somehow - we're calling |
rust-lang/rust#47146 seems to have caused this? |
Yeah, looks like a strong candidate. We probably need to completly reset the SpanHandler, rather than just calling |
I'm curious about what could be breaking |
Or maybe I'm just wrong and Sorry, it was my first contribution and didn't know I also had to check |
So, yes, you are right @nrc about your suspicions about the state. Calling to Here, we only emit the diagnostic if it wasn't emitted before (the exact same diagnostic), here we discard repeated diagnostics. And thus, with rust-lang/rust#47146 the error count will never get increased again for this very same error, as the state is kept despite the count was reset. |
Don't worry! We're still experimenting with how to manage tools in the Rust repo and at the moment tools get silently broken with no warning, so there is no reason you should have known. Yes, I assumed it was the hashing that was causing the problem, I should have been more explicit, but I was hoping for a quick fix and it was late :-) |
Just wanted to comment that this patch on diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index c4db39fae8..5001ce7a41 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -313,6 +313,7 @@ impl Handler {
// NOTE: DO NOT call this function from rustc, as it relies on `err_count` being non-zero
// if an error happened to avoid ICEs. This function should only be called from tools.
pub fn reset_err_count(&self) {
+ self.emitted_diagnostics.replace(FxHashSet());
self.err_count.store(0, SeqCst);
} However I'm not sure if the semantics of What do you think? I'd be willing to help fixing the problem since somehow I was the one that caused it. |
@ereslibre Thank you for the PR! |
Clean emitted diagnostics when `reset_err_count` is called. When external tools like `rustfmt` calls to `reset_err_count` for handler reusing, it will set the error count on the handler to 0, but since #47146 the handler will contain status that will prevent the error count to be bumped if this handler is reused. This caused `rustfmt` idempotency tests to fail: rust-lang/rustfmt#2338 Fixes: rust-lang/rustfmt#2338
Fixed on |
idempotence_tests
is failing:cargo test
passed without any error withrustc 1.24.0-nightly (b65f0bedd 2018-01-01)
.The text was updated successfully, but these errors were encountered: