Skip to content

Non-fatal error while running a specific cargo check command #128130

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

Closed
Kiwifuit opened this issue Jul 24, 2024 · 5 comments
Closed

Non-fatal error while running a specific cargo check command #128130

Kiwifuit opened this issue Jul 24, 2024 · 5 comments
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Kiwifuit
Copy link

Code

I'm sorry I cannot provide a minimal code example as I am equally confused with this issue. However, I have tried this and it produces the error.
The original repository can be found here

I am using rust-analyzer v0.3.2045 with the command it spat out:

cargo check --workspace --message-format=json-diagnostic-rendered-ansi --manifest-path <Cargo.toml> --keep-going --all-targets

No error is produced with cargo check, just with these specific flags

Meta

rustc --version --verbose:

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

This issue only happens with the stable build

Error output

thread 'rustc' panicked at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/compiler/rustc_query_system/src/dep_graph/serialized.rs:192:9:
thread 'rustc' panicked at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/compiler/rustc_query_system/src/dep_graph/serialized.rs:192:9:
assertion `left == right` failed
assertion `left == right` failed
  left: 3194662
  left: 3225253
 right: 0
 right: 0
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:409:17
   3: core::panicking::assert_failed::<usize, usize>
   4: rustc_incremental::persist::load::setup_dep_graph
   5: <rustc_interface::queries::Queries>::global_ctxt
   6: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
   0: rust_begin_unwind
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5

   1: core::panicking::panic_fmt
error: the compiler unexpectedly panicked. this is a bug.
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14

   2: core::panicking::assert_failed_inner
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:409:17

note: rustc 1.79.0 (129f3b996 2024-06-10) running on x86_64-unknown-linux-gnu
   3: core::panicking::assert_failed::<usize, usize>

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
   4: rustc_incremental::persist::load::setup_dep_graph

   5: <rustc_interface::queries::Queries>::global_ctxt
note: some of the compiler flags provided by cargo are hidden
   6: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}

@Kiwifuit Kiwifuit added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 24, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 24, 2024
@tgross35
Copy link
Contributor

tgross35 commented Jul 24, 2024

Does this issue persist after you do cargo clean or does it go away? Some things like this are cache-related.

This issue only happens with the stable build

Meaning the issue doesn't show up on nightly?

@Kiwifuit
Copy link
Author

Does this issue persist after you do cargo clean or does it go away? Some things like this are cache-related.

It goes away

Meaning the issue doesn't show up on nightly?

Yes, i have tried this command:

cargo +nightly check --workspace --message-format=json-diagnostic-rendered-ansi --manifest-path <Cargo.toml> --keep-going --all-targets

@tgross35
Copy link
Contributor

It goes away

Does it stay away, or is does running your command make it happen again?

@saethlin saethlin self-assigned this Jul 24, 2024
@saethlin saethlin added A-incr-comp Area: Incremental compilation and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 24, 2024
@saethlin
Copy link
Member

saethlin commented Jul 24, 2024

This ICE is due to an incremental compilation file which is corrupt, probably because it was damaged by another process. This scenario seems to be so frequent that I've turned the ICE into a warning with a recovery path that just ignores the file. That change is in 1.80, which will be stable tomorrow.

@saethlin
Copy link
Member

As far as I can tell, the ICE reported in this issue is caused by another process damaging rustc's build artifacts or by a buggy filesystem. That other process could be anything from an IDE running the compiler at the same time as a manual build to a find-and-replace that accidentally edits files in the target directory.

#124686 contains a mitigation for this situation; the compiler now has a crude way to detect and ignore damaged incremental compilation files. You will still get a warning about the damaged file, but the build should proceed normally. That change shipped in Rust 1.80 which released today, so I am closing this issue and a few others which as far as I can tell all have the same root cause. You shouldn't see this ICE anymore, but please file a new issue if you see something like it on 1.80 or later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants