rustfmt: rustfmt_nightly: query stack during panic: end of query stack
Hi,
When attempting to run cargo fmt on a the ill-typed (or maybe not even parsable?) library consisting of two files:
lib.rs:
mod foo;
foo.rs
const BAR = 42;
the compiler unexpectedly panics due to a failed assertion:
thread 'main' panicked at compiler/rustc_errors/src/lib.rs:565:9:
assertion failed: self.stashed_diagnostics.is_empty()
with rustc 1.78.0-nightly (fc3800f65 2024-02-26). Full stack-trace:
rustc-ice-2024-02-27T19_28_13-1514879.txt
I’m happy to work on this, but I’m a bit clueless as to what the issue is.
About this issue
- Original URL
- State: open
- Created 4 months ago
- Comments: 15 (8 by maintainers)
@mzacho thanks for confirming!
@namanlp Yup, that should be it. I’d take a similar approach to the other tests in src/test/parser.rs
If you want, you can also add the code snippet from https://github.com/rust-lang/rustfmt/issues/6082#issuecomment-1952590404 as a separate test case, which deals with the same issue and contains a complete code snippet without any parse errors. No problem if not. If you choose to also include that code snippet all you’d need to do is add it to a file in the
tests/targetdirectory, which is typically what you’d do when adding test cases to rustfmt.Hi @ytmimi ,
Yes, I can see that error.
So, as per my understanding, I have to add the test files to tests/parser , and then, add a similar driver code here src/test/parser.rs
Is that ok?
@ytmimi Latest nightly cargo fmt works for me again. Thanks!
@wmmc88 thanks for taking the time to look into this. I believe we’re still waiting on #6082 to be resolved. I’m hopeful that https://github.com/rust-lang/rust/pull/121301 will fix the issue on nightly once it’s merged 🤞🏼
https://github.com/rust-lang/rust/pull/121487 should fix this.