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

Compiler started panicking on build, reverting changes does not stop crashes #79852

Closed
ZacBlanco opened this issue Dec 9, 2020 · 3 comments
Closed
Labels
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

@ZacBlanco
Copy link

ZacBlanco commented Dec 9, 2020

Sorry, I don't have much experience with the Rust compiler yet -- would love to learn more :)

I was working on a project for a class doing some system benchmarking on nightly Rust. Everything was working and after a set of changes I started getting compiler crashes. Still trying to work out exactly what change triggered the crashes. I reverted a bunch of code to a state where I knew it compiled previously but it still crashed. I'm unsure if it's related to my code or not. I've attached a zip with the Cargo.toml and the main.rsfile.

Since reverting changes does not seem to affect the build, could this be an issue with already-compiled artifacts under ./target?

Code

I don't have the time right now to provide a strictly minimal example -- I could not reproduce this either. The two files in there are the only artifacts in the project.

code.tar.gz
See attached code.tar.gz

Meta

rustc --version --verbose:

zac@hulk:~/projects/cse221$ rustc --version --verbose
rustc 1.50.0-nightly (3d6705aa5 2020-12-07)
binary: rustc
commit-hash: 3d6705aa5abffe94c83bf09af8c3ba3c599845fc
commit-date: 2020-12-07
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

zac@hulk:~/projects/cse221$ RUST_BACKTRACE=1 cargo build
   Compiling cse221 v0.1.0 (/home/zac/projects/cse221)
warning: constant is never used: `GB`
   --> src/main.rs:817:1
    |
817 | const GB: usize = 1024 * MB;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: function is never used: `drop_caches`
    --> src/main.rs:1041:4
     |
1041 | fn drop_caches() -> Result<(), Err> {
     |    ^^^^^^^^^^^

warning: function is never used: `measure_buffer_cache`
    --> src/main.rs:1056:4
     |
1056 | fn measure_buffer_cache() -> Result<(), Err> {
     |    ^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:50:5
   3: rustc_middle::ty::query::try_load_from_on_disk_cache
   4: rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions
   5: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   6: rustc_incremental::persist::save::save_in
   7: rustc_data_structures::sync::join
   8: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   9: rustc_incremental::persist::save::save_dep_graph
  10: rustc_codegen_ssa::base::finalize_tcx
  11: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  12: rustc_session::utils::<impl rustc_session::session::Session>::time
  13: rustc_interface::passes::QueryContext::enter
  14: rustc_interface::queries::Queries::ongoing_codegen
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

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

note: rustc 1.50.0-nightly (3d6705aa5 2020-12-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: 3 warnings emitted

error: could not compile `cse221`

To learn more, run the command again with --verbose.

backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:50:5
   3: rustc_middle::ty::query::try_load_from_on_disk_cache
   4: rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions
   5: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   6: rustc_incremental::persist::save::save_in
   7: rustc_data_structures::sync::join
   8: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
   9: rustc_incremental::persist::save::save_dep_graph
  10: rustc_codegen_ssa::base::finalize_tcx
  11: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  12: rustc_session::utils::<impl rustc_session::session::Session>::time
  13: rustc_interface::passes::QueryContext::enter
  14: rustc_interface::queries::Queries::ongoing_codegen
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@ZacBlanco ZacBlanco 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 Dec 9, 2020
@ZacBlanco ZacBlanco changed the title Compiler started crashing on build, reverting changes does not stop crashes Compiler started panicking on build, reverting changes does not stop crashes Dec 9, 2020
@ZacBlanco
Copy link
Author

A brief update:
I saved the state under the ./target directory somewhere else in case it could be useful, and then tried compiling again with a fresh build directory. With a fresh directory, everything worked fine.

Based on this, I would suspect that somehow some compiled files in the build directory were corrupted? The compressed directory is ~155M. If someone thinks the state of the build directory would be useful to try to reproduce this I can upload it somewhere.

@ghost
Copy link

ghost commented Dec 9, 2020

I think this is #79661.
By the way, I'm just a normal Rust user reporting a bug here, but even I noticed that #79661 is duplicated many times.

@LeSeulArtichaut
Copy link
Contributor

Closing as duplicate of #79661. Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants