Skip to content

ICE: failed to lookup SourceFile in new context, On Disk Cache (Likely Incremental Compilation) #92221

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
HTGAzureX1212 opened this issue Dec 23, 2021 · 2 comments
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

@HTGAzureX1212
Copy link
Contributor

Code

// no minimal code example right now

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (34926f0a1 2021-12-22)
binary: rustc
commit-hash: 34926f0a1681458588a2d4240c0715ef9eff7d35
commit-date: 2021-12-22
host: x86_64-pc-windows-msvc
release: 1.59.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'failed to lookup `SourceFile` in new context', compiler\rustc_query_impl\src\on_disk_cache.rs:500:22
<- backtrace snip ->

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.59.0-nightly (34926f0a1 2021-12-22) running on x86_64-pc-windows-msvc

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

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

query stack during panic:
#0 [typeck] type-checking `shard::tls::<impl at gateway\src\shard\tls.rs:124:1: 192:2>::new`
#1 [analysis] running analysis passes on this crate
end of query stack
Backtrace

stack backtrace:
   0:     0x7ff85bad9c4f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1c0faa8e21402239
   1:     0x7ff85bb047fa - core::fmt::write::h6efff9e6685dd399
   2:     0x7ff85bacb738 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h58662e78e3ff767a
   3:     0x7ff85badd3a6 - std::panicking::take_hook::hbf0ed3abfbb378ae
   4:     0x7ff85badce89 - std::panicking::take_hook::hbf0ed3abfbb378ae
   5:     0x7ff84a3c96d6 - <rustc_codegen_ssa[e0ee6c8923d78713]::back::linker::WasmLd as rustc_codegen_ssa[e0ee6c8923d78713]::back::linker::Linker>::full_relro
   6:     0x7ff85baddc09 - std::panicking::rust_panic_with_hook::hae1a1c7dcd301d4a
   7:     0x7ff85badd75b - rust_begin_unwind
   8:     0x7ff85bada577 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1c0faa8e21402239
   9:     0x7ff85badd6b9 - rust_begin_unwind
  10:     0x7ff85bb38a20 - core::panicking::panic_fmt::h33bb75d33096d4a7
  11:     0x7ff85bb01410 - <core::panic::panic_info::PanicInfo as core::fmt::Display>::fmt::h8744e4e66393ff92
  12:     0x7ff85bb3891b - core::option::expect_failed::h6086a715303a2cdc
  13:     0x7ff84db97193 - <rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::OnDiskCache>::load_side_effects
  14:     0x7ff84dcf9847 - <rustc_span[287d9056fff4e679]::span_encoding::Span as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  15:     0x7ff84dc81c56 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  16:     0x7ff84db86d10 - rustc_query_impl[77f8204ae2e36eee]::query_callbacks::diagnostic_hir_wf_check
  17:     0x7ff84db4bba3 - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  18:     0x7ff84daddaf8 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  19:     0x7ff84dc8b0a9 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  20:     0x7ff84db97344 - <rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::OnDiskCache>::load_side_effects
  21:     0x7ff84dc8b198 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  22:     0x7ff84db5309a - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  23:     0x7ff84db3386c - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  24:     0x7ff84dc8b583 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  25:     0x7ff84dadde15 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  26:     0x7ff84dc8b0a9 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  27:     0x7ff84db33ccb - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  28:     0x7ff84dc8fd73 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  29:     0x7ff84dae0e8a - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  30:     0x7ff84daddc9a - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  31:     0x7ff84dc8b0a9 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  32:     0x7ff84db5309a - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  33:     0x7ff84db32036 - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  34:     0x7ff84db33938 - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  35:     0x7ff84dc8b583 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  36:     0x7ff84daddd37 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  37:     0x7ff84dc8b0a9 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  38:     0x7ff84db97344 - <rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::OnDiskCache>::load_side_effects
  39:     0x7ff84dc8b198 - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  40:     0x7ff84db833c3 - rustc_query_impl[77f8204ae2e36eee]::query_callbacks::diagnostic_hir_wf_check
  41:     0x7ff84db35540 - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  42:     0x7ff84db95da7 - <rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::OnDiskCache>::load_side_effects
  43:     0x7ff84da3054b - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  44:     0x7ff84dabf1b2 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  45:     0x7ff84d97206d - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  46:     0x7ff84da93075 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  47:     0x7ff84e8f1669 - <rustc_middle[ffa1195741ac090d]::ty::context::TyCtxt>::typeck_body
  48:     0x7ff84d1d2a36 - <rustc_ast_lowering[b70ba207272648f]::index::NodeCollector as rustc_hir[d228ea4b02bf657a]::intravisit::Visitor>::visit_foreign_item_ref
  49:     0x7ff84d1c30fa - <rustc_ast_lowering[b70ba207272648f]::index::NodeCollector as rustc_hir[d228ea4b02bf657a]::intravisit::Visitor>::visit_foreign_item_ref
  50:     0x7ff84d2502fd - rustc_passes[c65bb02ac2a057c1]::dead::check_crate
  51:     0x7ff84a5f35d7 - <rustc_interface[20c1d82311350120]::passes::boxed_resolver::BoxedResolver>::to_resolver_outputs
  52:     0x7ff84a5f4cb8 - <rustc_interface[20c1d82311350120]::passes::boxed_resolver::BoxedResolver>::to_resolver_outputs
  53:     0x7ff84a5e314e - <rustc_interface[20c1d82311350120]::passes::boxed_resolver::BoxedResolver>::to_resolver_outputs
  54:     0x7ff84a530fb7 - rustc_interface[20c1d82311350120]::passes::analysis
  55:     0x7ff84db08b3b - <rustc_query_impl[77f8204ae2e36eee]::Queries as rustc_middle[ffa1195741ac090d]::ty::query::QueryEngine>::try_mark_green
  56:     0x7ff84dc5012e - <&[rustc_ast[8abf6c33ee56ca8f]::ast::InlineAsmTemplatePiece] as rustc_serialize[60cb07fa1184e247]::serialize::Decodable<rustc_query_impl[77f8204ae2e36eee]::on_disk_cache::CacheDecoder>>::decode
  57:     0x7ff84dacc161 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  58:     0x7ff84d9f7859 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  59:     0x7ff84da934c2 - <rustc_mir_dataflow[4f6be34a205e6d32]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[4f6be34a205e6d32]::framework::AnalysisDomain>::initialize_start_block
  60:     0x7ff84a44b9d0 - <rustc_driver[8f8cdc58d4efa3d0]::args::Error as core[32c041dd6eacc0a9]::fmt::Debug>::fmt
  61:     0x7ff84a3f0595 - <rustc_middle[ffa1195741ac090d]::ty::SymbolName as core[32c041dd6eacc0a9]::fmt::Debug>::fmt
  62:     0x7ff84a3e4705 - rustc_driver[8f8cdc58d4efa3d0]::pretty::print_after_hir_lowering
  63:     0x7ff84a3f18f1 - <rustc_middle[ffa1195741ac090d]::ty::SymbolName as core[32c041dd6eacc0a9]::fmt::Debug>::fmt
  64:     0x7ff84a3ed5b3 - rustc_driver[8f8cdc58d4efa3d0]::pretty::print_after_hir_lowering
  65:     0x7ff84a467bd8 - <rustc_driver[8f8cdc58d4efa3d0]::args::Error as core[32c041dd6eacc0a9]::fmt::Debug>::fmt
  66:     0x7ff85baeb38c - std::sys::windows::thread::Thread::new::h66c16ba099b8d93b
  67:     0x7ff8d3367034 - BaseThreadInitThunk
  68:     0x7ff8d5062651 - RtlUserThreadStart

This is likely related to incremental compilation (changing the code a bit then recompile is enough to reproduce this ICE after some thorough testing locally).

@HTGAzureX1212 HTGAzureX1212 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 23, 2021
@HTGAzureX1212
Copy link
Contributor Author

HTGAzureX1212 commented Dec 23, 2021

Running cargo clean then cargo build/test/check resolves the issue.

@HTGAzureX1212 HTGAzureX1212 changed the title ICE: failed to lookup SourceFile in new context (Likely Incremental Compilation) ICE: failed to lookup SourceFile in new context, On Disk Cache (Likely Incremental Compilation) Dec 23, 2021
@ehuss
Copy link
Contributor

ehuss commented Dec 23, 2021

Thanks for the report!

Yes, this is an incremental issue. You can delete the incremental directory, or use CARGO_INCREMENTAL=0 to disable incremental compilation.

Closing as a duplicate of #92163.

@ehuss ehuss closed this as completed Dec 23, 2021
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