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

Rust crashes due to unknown cache changes #89457

Closed
kayabaNerve opened this issue Oct 2, 2021 · 5 comments
Closed

Rust crashes due to unknown cache changes #89457

kayabaNerve opened this issue Oct 2, 2021 · 5 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@kayabaNerve
Copy link

kayabaNerve commented Oct 2, 2021

Meta

Version:

rustc 1.57.0-nightly (5ecc8ad84 2021-09-19)

Error output

Backtrace

user@computer:~/dleq-rs$ RUST_BACKTRACE=1 cargo test
   Compiling dleq v0.0.0 (/home/user/dleq-rs)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/compiler/rustc_hir/src/definitions.rs:452:14
stack backtrace:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/compiler/rustc_hir/src/definitions.rs:452:14
stack backtrace:
   0: rust_begin_unwind
   0: rust_begin_unwind
             at /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/library/core/src/panicking.rs:103:14
             at /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/library/std/src/panicking.rs:517:5
   2: core::panicking::panic
   1: core::panicking::panic_fmt
             at /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/library/core/src/panicking.rs:103:14
             at /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/library/core/src/panicking.rs:50:5
   2: core::panicking::panic
             at /rustc/5ecc8ad8462574354a55162a0c16b10eb95e3e70/library/core/src/panicking.rs:50:5
   3: <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id
   3: <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id
   4: rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::LocalDefId>::recover
   4: rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::LocalDefId>::recover
   5: rustc_query_impl::query_callbacks::hir_owner::force_from_dep_node
   5: rustc_query_impl::query_callbacks::hir_owner::force_from_dep_node
   6: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   7: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   6: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   7: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   8: rustc_query_system::query::plumbing::ensure_must_run
   8: rustc_query_system::query::plumbing::ensure_must_run
   9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::fn_sig
   9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::fn_sig
  10: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_impl_item
  10: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_impl_item
  11: rustc_middle::hir::map::Map::visit_item_likes_in_module
  11: rustc_middle::hir::map::Map::visit_item_likes_in_module
  12: rustc_typeck::collect::collect_mod_item_types
  12: rustc_typeck::collect::collect_mod_item_types
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  14: rustc_data_structures::stack::ensure_sufficient_stack
  14: rustc_data_structures::stack::ensure_sufficient_stack
  15: rustc_query_system::query::plumbing::try_execute_query
  16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  15: rustc_query_system::query::plumbing::try_execute_query
  16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  17: rustc_middle::hir::map::Map::for_each_module
  17: rustc_middle::hir::map::Map::for_each_module
  18: rustc_session::session::Session::track_errors
  18: rustc_session::session::Session::track_errors
  19: rustc_typeck::check_crate
  20: rustc_interface::passes::analysis
  19: rustc_typeck::check_crate
  20: rustc_interface::passes::analysis
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  22: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::try_execute_query
  24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  25: rustc_interface::passes::QueryContext::enter
  23: rustc_query_system::query::plumbing::try_execute_query
  24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  25: rustc_interface::passes::QueryContext::enter
  26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  27: rustc_span::with_source_map
  27: rustc_span::with_source_map
  28: scoped_tls::ScopedKey<T>::set
  28: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


error: internal compiler error: unexpected panic

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
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.57.0-nightly (5ecc8ad84 2021-09-19) running on x86_64-unknown-linux-gnu
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: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental
note: rustc 1.57.0-nightly (5ecc8ad84 2021-09-19) running on x86_64-unknown-linux-gnu


note: some of the compiler flags provided by cargo are hidden
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib


query stack during panic:
note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [collect_mod_item_types] collecting item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
#0 [collect_mod_item_types] collecting item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `dleq`
warning: build failed, waiting for other jobs to finish...
error: build failed
user@computer:~/dleq-rs$

Encountered while working on a project of mine. I copied the directory to another location to back it up, and went there to confirm the same command exhibited the same behavior. The changed path triggered a rebuild and this caused rustc to work without issue, leading me to believe there's a malformed cache. I have been updating my Cargo.toml, from additions to removals to even a version upgrade. That said, my only change before my last successful compile and this one was introducing a few errors while I expanded functionality. I was hoping my malformed code would offer a MRE, yet unfortunately (or fortunately) Rust can handle it.

I am on nightly and went to the latest nightly to check this was still an issue. Doing so rebuilt my cache yet again, hence why my version info is what it is (it's rustup's logs on what it upgraded from). I do have a copy of the cache directory, as it caused errors, I'd be willing to send privately if it'd be beneficial. I never directly edited it. As for the code edits, those would be harder to track down due to the fact I'm in the middle of a commit, and can't confirm what my code was on the last successful compile in order to provide such a diff.

@kayabaNerve kayabaNerve 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 Oct 2, 2021
@kayabaNerve
Copy link
Author

I just realized this asked for RUST_BACKTRACE=full and I provided RUST_BACKTRACE=1 (as I was already using that on my tests), sorry. If there's a command I can use to revert my Rust install in a way that won't trigger a rebuild when I try it against my preserved faulty cache (which I'd have to move back to its original position, of course), I'm more than willing to run it and provide the proper backtrace.

@pr2502
Copy link
Contributor

pr2502 commented Oct 3, 2021

The top of the stack trace seems identical to #89260

@teor2345
Copy link
Contributor

teor2345 commented Oct 10, 2021

I'm still seeing an ICE with a very similar backtrace.
It's also similar to #89260.

It happens when building https://github.com/ZcashFoundation/zebra , but only when the on-disk cache is in a particular state. (Approximately every ~100 builds.)

So I can't provide an easy reproduction.

I'm using:

rustc 1.57.0-nightly (25ec82738 2021-10-05)
binary: rustc
commit-hash: 25ec8273855fde2d72ae877b397e054de5300e10
commit-date: 2021-10-05
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/25ec8273855fde2d72ae877b397e054de5300e10/compiler/rustc_hir/src/definitions.rs:452:14                         
stack backtrace:                                                                               
   0:     0x7f3021e332ec - std::backtrace_rs::backtrace::libunwind::trace::h49c840f3a952c2eb
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5                                              
   1:     0x7f3021e332ec - std::backtrace_rs::backtrace::trace_unsynchronized::h970fbed62f2c306d                                                                                               
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5                                                    
   2:     0x7f3021e332ec - std::sys_common::backtrace::_print_fmt::h41e6dcef610013be                                                                                                           
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/sys_common/backtrace.rs:67:5                                                                 
   3:     0x7f3021e332ec - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47eb9d690c7ee406                                                                
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/sys_common/backtrace.rs:46:22                                                                
   4:     0x7f3021e90bcc - core::fmt::write::h72801a82c94e6ff1                                                                                                                                 
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/core/src/fmt/mod.rs:1162:17                                                                          
   5:     0x7f3021e23e05 - std::io::Write::write_fmt::hd6b82cb7eca8de25
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/io/mod.rs:1684:15                                                                            
   6:     0x7f3021e36560 - std::sys_common::backtrace::_print::hb52aa722c5512ecd
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/sys_common/backtrace.rs:49:5                                                                 
   7:     0x7f3021e36560 - std::sys_common::backtrace::print::he2e1e8a2ae490cb5
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/sys_common/backtrace.rs:36:9                                                                 
   8:     0x7f3021e36560 - std::panicking::default_hook::{{closure}}::h456b8dc7e1036ef7 
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/panicking.rs:210:50                                                                          
   9:     0x7f3021e3610b - std::panicking::default_hook::h112e1a03bb7f7411              
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/panicking.rs:227:9                                                                           
  10:     0x7f3022650c61 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h4b4c6f10efa3d667                                                                                             
  11:     0x7f2ffc622a8b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h51f913132d10fc93                                                                                  
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/alloc/src/boxed.rs:1652:9                                                                            
  12:     0x7f2ffc622a8b - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h411d854584c329f5                                                   
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/proc_macro/src/bridge/client.rs:320:21                                                               
  13:     0x7f3021e36d79 - std::panicking::rust_panic_with_hook::h9d04d157d3d966dc
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/panicking.rs:628:17                                                                          
  14:     0x7f3021e36802 - std::panicking::begin_panic_handler::{{closure}}::heb8583e1f0ca0bb3                                                                                                 
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/panicking.rs:519:13                                                                          
  15:     0x7f3021e337a4 - std::sys_common::backtrace::__rust_end_short_backtrace::hf7f7df37cc03b639                                                                                           
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/sys_common/backtrace.rs:141:18 
  16:     0x7f3021e36799 - rust_begin_unwind   
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/panicking.rs:517:5
  17:     0x7f3021dfc4f1 - core::panicking::panic_fmt::h7b8580d81fcbbacd
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/core/src/panicking.rs:100:14
  18:     0x7f3021dfc43d - core::panicking::panic::h50b51d19800453c0
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/core/src/panicking.rs:50:5
  19:     0x7f3023fe5237 - <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id::hc003ddf41aae4dd3
  20:     0x7f30244a12b1 - rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::LocalDefI
d>::recover::h145032126081f004
  21:     0x7f3024aaa4ec - rustc_query_impl::query_callbacks::hir_owner::force_from_dep_node::h476eb9e8974ac027
  22:     0x7f3023fc5483 - rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green::h0a597ce211b4655d
  23:     0x7f3023fc4f8a - rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green::h0a597ce211b4655d
  24:     0x7f3024ab5d31 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h13792bc06ebd8d7f
  25:     0x7f3024b73e3b - rustc_codegen_ssa::base::determine_cgu_reuse::hb06d9b8284b4d95f
  26:     0x7f302458ef59 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h4c7b771af7b02f5f
  27:     0x7f30245c3170 - rustc_session::utils::<impl rustc_session::session::Session>::time::ha74abf1799ccf45f
  28:     0x7f30245a62f0 - rustc_codegen_ssa::base::codegen_crate::hd0da505449289dd5
  29:     0x7f30245cab5a - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h5376336857a45526
  30:     0x7f3024575517 - rustc_session::utils::<impl rustc_session::session::Session>::time::ha5e95f6c912fa8bd
  31:     0x7f302454ff99 - rustc_interface::queries::Queries::ongoing_codegen::hbf81f4412ce3471d
  32:     0x7f302452f639 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hb21794c7afdd7aa9
  33:     0x7f302451fc4f - rustc_span::with_source_map::h1577f9979c3dd3cd
  34:     0x7f302452ee40 - scoped_tls::ScopedKey<T>::set::h1a43900433c14947
  35:     0x7f3024520395 - std::sys_common::backtrace::__rust_begin_short_backtrace::hda517dd2e82ac21b
  36:     0x7f3024542632 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h32907797a154493d
  37:     0x7f3021e42083 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3a82802338f49654
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/alloc/src/boxed.rs:1638:9
  38:     0x7f3021e42083 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd13a4d0f57fcdf47
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/alloc/src/boxed.rs:1638:9
  39:     0x7f3021e42083 - std::sys::unix::thread::Thread::new::thread_start::hee01618890f121bb 
                               at /rustc/25ec8273855fde2d72ae877b397e054de5300e10/library/std/src/sys/unix/thread.rs:106:17
  40:     0x7f3021d81d3e - start_thread
  41:     0x7f3021c9c43f - __clone
  42:                0x0 - <unknown>

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.57.0-nightly (25ec82738 2021-10-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z share-generics=y -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental -C link-arg=-fuse-ld=lld

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

query stack during panic:
end of query stack

@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Nov 8, 2021
@BGR360
Copy link
Contributor

BGR360 commented Dec 21, 2021

Possible dupe of #91696. Hopefully fixed by #91919.

@rustbot label +A-incr-comp

@rustbot rustbot added the A-incr-comp Area: Incremental compilation label Dec 21, 2021
@workingjubilee
Copy link
Contributor

Closing assuming the previous "it's a duplicate" is correct, because it seems so to my eyes. Should be fixed by either that or #93064

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. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

7 participants