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

ICE: 'index out of bounds' in on_disk_cache.rs, then double panic 'Illegal read of:' #108481

Closed
kpreid opened this issue Feb 26, 2023 · 13 comments · Fixed by #109935
Closed

ICE: 'index out of bounds' in on_disk_cache.rs, then double panic 'Illegal read of:' #108481

kpreid opened this issue Feb 26, 2023 · 13 comments · Fixed by #109935
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) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kpreid
Copy link
Contributor

kpreid commented Feb 26, 2023

This is one of those ICEs that are terribly hard to minimize because they happen randomly and cache-dependently, but hopefully the backtraces will be useful [update: see below for repro instructions]. If nothing else, notice that there is a panic while trying to print the query stack; it might be desirable to look into making that not happen so as to be able to get more information.

Meta

Occurred while running cargo check or cargo clippy.

rustc --version --verbose:

rustc 1.67.1 (d5a82bbd2 2023-02-07)
binary: rustc
commit-hash: d5a82bbd26e1ad8b7401f6a718a9c57c96905483
commit-date: 2023-02-07
host: x86_64-apple-darwin
release: 1.67.1
LLVM version: 15.0.6

Error output

$ /Users/kpreid/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo clippy
    Checking all-is-cubes v0.5.0 (/Users/kpreid/Projects/all-is-cubes/all-is-cubes)
warning: glob import doesn't reexport anything because no candidate is public enough
  --> /Users/kpreid/Projects/all-is-cubes/all-is-cubes/src/mesh/chunked_mesh.rs:20:9
   |
20 | pub use blocks::*;
   |         ^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

thread 'rustc' panicked at 'index out of bounds: the len is 536 but the index is 667', compiler/rustc_query_impl/src/on_disk_cache.rs:717:40
stack backtrace:
[[[backtrace trimmed; see backtrace section below]]]

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.67.1 (d5a82bbd2 2023-02-07) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
thread 'rustc' panicked at 'Illegal read of: 58907', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/compiler/rustc_query_system/src/dep_graph/graph.rs:450:25
stack backtrace:
[[[backtrace trimmed; see backtrace section below]]]

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.67.1 (d5a82bbd2 2023-02-07) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
thread panicked while processing panic. aborting.
warning: `all-is-cubes` (lib) generated 1 warning
error: could not compile `all-is-cubes`; 1 warning emitted
Backtrace

$ /Users/kpreid/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo clippy
    Checking all-is-cubes v0.5.0 (/Users/kpreid/Projects/all-is-cubes/all-is-cubes)
warning: glob import doesn't reexport anything because no candidate is public enough
  --> /Users/kpreid/Projects/all-is-cubes/all-is-cubes/src/mesh/chunked_mesh.rs:20:9
   |
20 | pub use blocks::*;
   |         ^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

thread 'rustc' panicked at 'index out of bounds: the len is 536 but the index is 667', compiler/rustc_query_impl/src/on_disk_cache.rs:717:40
stack backtrace:
   0:        0x10aaeb796 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb2b3f9f8dc23cb9d
   1:        0x10ab4a1ea - core::fmt::write::h603bc3f9f076a504
   2:        0x10aaddbbc - std::io::Write::write_fmt::haffd946fd0c71703
   3:        0x10aaeb57a - std::sys_common::backtrace::print::hf660b768f462926e
   4:        0x10aaee8e3 - std::panicking::default_hook::{{closure}}::hb5b3e9f2c6b6790b
   5:        0x10aaee638 - std::panicking::default_hook::ha10903320e35543e
   6:        0x11a3746dd - rustc_driver[8e093e25fe36b41b]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10aaef0c7 - std::panicking::rust_panic_with_hook::h52ed83dd7c5d1444
   8:        0x10aaeee74 - std::panicking::begin_panic_handler::{{closure}}::h5f4e10879935eaea
   9:        0x10aaebc38 - std::sys_common::backtrace::__rust_end_short_backtrace::hadc7b677a554f9f9
  10:        0x10aaeeb3d - _rust_begin_unwind
  11:        0x10ab76993 - core::panicking::panic_fmt::hc10ef4c7e7c3da2e
  12:        0x10ab76ad6 - core::panicking::panic_bounds_check::hf660537e54ee196e
  13:        0x11de45ce7 - <rustc_span[2625accf23a29991]::SourceFile>::lines::<<rustc_span[2625accf23a29991]::span_encoding::Span as rustc_serialize[a208a1dcefcb3cbf]::serialize::Decodable<rustc_query_impl[cfd1e86cd19618c3]::on_disk_cache::CacheDecoder>>::decode::{closure#0}, rustc_span[2625accf23a29991]::BytePos>
  14:        0x11dde2841 - <rustc_span[2625accf23a29991]::span_encoding::Span as rustc_serialize[a208a1dcefcb3cbf]::serialize::Decodable<rustc_query_impl[cfd1e86cd19618c3]::on_disk_cache::CacheDecoder>>::decode
  15:        0x11de29509 - <rustc_query_impl[cfd1e86cd19618c3]::on_disk_cache::OnDiskCache>::try_load_query_result::<rustc_span[2625accf23a29991]::span_encoding::Span>
  16:        0x11df80871 - rustc_query_impl[cfd1e86cd19618c3]::plumbing::try_load_from_disk::<rustc_span[2625accf23a29991]::span_encoding::Span>
  17:        0x11dff0946 - <rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind as rustc_query_system[b885f6fe60382e2e]::dep_graph::DepKind>::with_deps::<rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_span[2625accf23a29991]::def_id::DefId, core[36719e2ca9cc5cdf]::option::Option<rustc_middle[fc7ebf79883dfa5a]::ty::Destructor>>::{closure#0}, core[36719e2ca9cc5cdf]::option::Option<core[36719e2ca9cc5cdf]::option::Option<rustc_middle[fc7ebf79883dfa5a]::ty::Destructor>>>
  18:        0x11dd0c588 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_span[2625accf23a29991]::def_id::DefId, rustc_span[2625accf23a29991]::span_encoding::Span>
  19:        0x11dc1a07c - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<rustc_span[2625accf23a29991]::def_id::DefId, rustc_span[2625accf23a29991]::span_encoding::Span>>
  20:        0x11dd4a84f - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::def_span, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  21:        0x11ddd3ba5 - <rustc_query_impl[cfd1e86cd19618c3]::Queries as rustc_middle[fc7ebf79883dfa5a]::ty::query::QueryEngine>::def_span
  22:        0x11cb2cc7d - rustc_ty_utils[2e8d38d334874b81]::ty::param_env
  23:        0x11df2c78e - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, rustc_span[2625accf23a29991]::def_id::DefId, rustc_middle[fc7ebf79883dfa5a]::ty::ParamEnv>
  24:        0x11dc247cc - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<rustc_span[2625accf23a29991]::def_id::DefId, rustc_middle[fc7ebf79883dfa5a]::ty::ParamEnv>>
  25:        0x11dd4bab5 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::param_env, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  26:        0x11cc5f854 - <rustc_hir_typeck[6a8d7b4346cd089d]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_with_fallback<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_const_arg::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  27:        0x11cc85c41 - rustc_hir_typeck[6a8d7b4346cd089d]::typeck_const_arg
  28:        0x11dfed5ba - <rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind as rustc_query_system[b885f6fe60382e2e]::dep_graph::DepKind>::with_deps::<<rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (rustc_span[2625accf23a29991]::def_id::LocalDefId, rustc_span[2625accf23a29991]::def_id::DefId), &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>::{closure#0}, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  29:        0x11df50d42 - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (rustc_span[2625accf23a29991]::def_id::LocalDefId, rustc_span[2625accf23a29991]::def_id::DefId), &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  30:        0x11dc650a1 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<(rustc_span[2625accf23a29991]::def_id::LocalDefId, rustc_span[2625accf23a29991]::def_id::DefId), &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>>
  31:        0x11dd3ac7d - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::typeck_const_arg, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  32:        0x11ddd33e7 - <rustc_query_impl[cfd1e86cd19618c3]::Queries as rustc_middle[fc7ebf79883dfa5a]::ty::query::QueryEngine>::typeck_const_arg
  33:        0x11cc867ba - rustc_hir_typeck[6a8d7b4346cd089d]::typeck
  34:        0x11df1fa2f - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, rustc_span[2625accf23a29991]::def_id::LocalDefId, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  35:        0x11dcb8f0e - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::VecCache<rustc_span[2625accf23a29991]::def_id::LocalDefId, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>>
  36:        0x11dd4a314 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::typeck, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  37:        0x11ccfa49a - std[3161060b00c850ea]::panicking::try::<(), core[36719e2ca9cc5cdf]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[5322186b9ea74ad0]::sync::par_for_each_in<&[rustc_span[2625accf23a29991]::def_id::LocalDefId], <rustc_middle[fc7ebf79883dfa5a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  38:        0x11ccfa695 - rustc_data_structures[5322186b9ea74ad0]::sync::par_for_each_in::<&[rustc_span[2625accf23a29991]::def_id::LocalDefId], <rustc_middle[fc7ebf79883dfa5a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_item_bodies::{closure#0}>::{closure#0}>
  39:        0x11cc859cd - rustc_hir_typeck[6a8d7b4346cd089d]::typeck_item_bodies
  40:        0x11df63cf6 - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (), ()>
  41:        0x11dc91839 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<(), ()>>
  42:        0x11dd3d191 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::typeck_item_bodies, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  43:        0x11cdeadfe - <rustc_session[6d4ac4b3b9abdb4d]::session::Session>::time::<(), rustc_hir_analysis[bf6ee3453ce961c4]::check_crate::{closure#7}>
  44:        0x11ce31435 - rustc_hir_analysis[bf6ee3453ce961c4]::check_crate
  45:        0x11a45348a - rustc_interface[22d5e9ac326097ba]::passes::analysis
  46:        0x11df56b36 - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (), core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  47:        0x11dc802a7 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<(), core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>>
  48:        0x11dd4a6f1 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::analysis, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  49:        0x11a303ab3 - <rustc_interface[22d5e9ac326097ba]::passes::QueryContext>::enter::<rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  50:        0x11a34ae32 - rustc_span[2625accf23a29991]::with_source_map::<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  51:        0x11a33ce6d - <scoped_tls[b2500c2140549217]::ScopedKey<rustc_span[2625accf23a29991]::SessionGlobals>>::set::<rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  52:        0x11a30c9aa - std[3161060b00c850ea]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[22d5e9ac326097ba]::util::run_in_thread_pool_with_globals<rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  53:        0x11a2eeaf5 - <<std[3161060b00c850ea]::thread::Builder>::spawn_unchecked_<rustc_interface[22d5e9ac326097ba]::util::run_in_thread_pool_with_globals<rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>::{closure#1} as core[36719e2ca9cc5cdf]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:        0x10aaf8437 - std::sys::unix::thread::Thread::new::thread_start::he272a3f7edb058e0
  55:     0x7ff80544d4e1 - __pthread_start

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.67.1 (d5a82bbd2 2023-02-07) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
thread 'rustc' panicked at 'Illegal read of: 58907', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/compiler/rustc_query_system/src/dep_graph/graph.rs:450:25
stack backtrace:
   0:        0x10aaeb796 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb2b3f9f8dc23cb9d
   1:        0x10ab4a1ea - core::fmt::write::h603bc3f9f076a504
   2:        0x10aaddbbc - std::io::Write::write_fmt::haffd946fd0c71703
   3:        0x10aaeb57a - std::sys_common::backtrace::print::hf660b768f462926e
   4:        0x10aaee8e3 - std::panicking::default_hook::{{closure}}::hb5b3e9f2c6b6790b
   5:        0x10aaee638 - std::panicking::default_hook::ha10903320e35543e
   6:        0x11a3746dd - rustc_driver[8e093e25fe36b41b]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10aaef0c7 - std::panicking::rust_panic_with_hook::h52ed83dd7c5d1444
   8:        0x10aaeee74 - std::panicking::begin_panic_handler::{{closure}}::h5f4e10879935eaea
   9:        0x10aaebc38 - std::sys_common::backtrace::__rust_end_short_backtrace::hadc7b677a554f9f9
  10:        0x10aaeeb3d - _rust_begin_unwind
  11:        0x10ab76993 - core::panicking::panic_fmt::hc10ef4c7e7c3da2e
  12:        0x11ebfa7c4 - <rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind as rustc_query_system[b885f6fe60382e2e]::dep_graph::DepKind>::read_deps::<<rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::read_index::{closure#0}>
  13:        0x11ed22617 - <rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt>::type_length_limit
  14:        0x11ec54a52 - rustc_middle[fc7ebf79883dfa5a]::query::descs::typeck
  15:        0x11df79313 - rustc_query_impl[cfd1e86cd19618c3]::plumbing::create_query_frame::<rustc_span[2625accf23a29991]::def_id::LocalDefId>
  16:        0x11dec3165 - <rustc_query_impl[cfd1e86cd19618c3]::query_structs::typeck::{closure#0} as core[36719e2ca9cc5cdf]::ops::function::FnOnce<(rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, &mut std[3161060b00c850ea]::collections::hash::map::HashMap<rustc_query_system[b885f6fe60382e2e]::query::job::QueryJobId, rustc_query_system[b885f6fe60382e2e]::query::job::QueryJobInfo, core[36719e2ca9cc5cdf]::hash::BuildHasherDefault<rustc_hash[7147e8159724e841]::FxHasher>>)>>::call_once
  17:        0x11de56f5d - rustc_query_system[b885f6fe60382e2e]::query::job::print_query_stack::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  18:        0x11a3fb583 - rustc_interface[22d5e9ac326097ba]::interface::try_print_query_stack
  19:        0x11a375491 - rustc_driver[8e093e25fe36b41b]::report_ice
  20:        0x10aaef0c7 - std::panicking::rust_panic_with_hook::h52ed83dd7c5d1444
  21:        0x10aaeee74 - std::panicking::begin_panic_handler::{{closure}}::h5f4e10879935eaea
  22:        0x10aaebc38 - std::sys_common::backtrace::__rust_end_short_backtrace::hadc7b677a554f9f9
  23:        0x10aaeeb3d - _rust_begin_unwind
  24:        0x10ab76993 - core::panicking::panic_fmt::hc10ef4c7e7c3da2e
  25:        0x10ab76ad6 - core::panicking::panic_bounds_check::hf660537e54ee196e
  26:        0x11de45ce7 - <rustc_span[2625accf23a29991]::SourceFile>::lines::<<rustc_span[2625accf23a29991]::span_encoding::Span as rustc_serialize[a208a1dcefcb3cbf]::serialize::Decodable<rustc_query_impl[cfd1e86cd19618c3]::on_disk_cache::CacheDecoder>>::decode::{closure#0}, rustc_span[2625accf23a29991]::BytePos>
  27:        0x11dde2841 - <rustc_span[2625accf23a29991]::span_encoding::Span as rustc_serialize[a208a1dcefcb3cbf]::serialize::Decodable<rustc_query_impl[cfd1e86cd19618c3]::on_disk_cache::CacheDecoder>>::decode
  28:        0x11de29509 - <rustc_query_impl[cfd1e86cd19618c3]::on_disk_cache::OnDiskCache>::try_load_query_result::<rustc_span[2625accf23a29991]::span_encoding::Span>
  29:        0x11df80871 - rustc_query_impl[cfd1e86cd19618c3]::plumbing::try_load_from_disk::<rustc_span[2625accf23a29991]::span_encoding::Span>
  30:        0x11dff0946 - <rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind as rustc_query_system[b885f6fe60382e2e]::dep_graph::DepKind>::with_deps::<rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_span[2625accf23a29991]::def_id::DefId, core[36719e2ca9cc5cdf]::option::Option<rustc_middle[fc7ebf79883dfa5a]::ty::Destructor>>::{closure#0}, core[36719e2ca9cc5cdf]::option::Option<core[36719e2ca9cc5cdf]::option::Option<rustc_middle[fc7ebf79883dfa5a]::ty::Destructor>>>
  31:        0x11dd0c588 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_span[2625accf23a29991]::def_id::DefId, rustc_span[2625accf23a29991]::span_encoding::Span>
  32:        0x11dc1a07c - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<rustc_span[2625accf23a29991]::def_id::DefId, rustc_span[2625accf23a29991]::span_encoding::Span>>
  33:        0x11dd4a84f - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::def_span, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  34:        0x11ddd3ba5 - <rustc_query_impl[cfd1e86cd19618c3]::Queries as rustc_middle[fc7ebf79883dfa5a]::ty::query::QueryEngine>::def_span
  35:        0x11cb2cc7d - rustc_ty_utils[2e8d38d334874b81]::ty::param_env
  36:        0x11df2c78e - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, rustc_span[2625accf23a29991]::def_id::DefId, rustc_middle[fc7ebf79883dfa5a]::ty::ParamEnv>
  37:        0x11dc247cc - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<rustc_span[2625accf23a29991]::def_id::DefId, rustc_middle[fc7ebf79883dfa5a]::ty::ParamEnv>>
  38:        0x11dd4bab5 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::param_env, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  39:        0x11cc5f854 - <rustc_hir_typeck[6a8d7b4346cd089d]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_with_fallback<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_const_arg::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  40:        0x11cc85c41 - rustc_hir_typeck[6a8d7b4346cd089d]::typeck_const_arg
  41:        0x11dfed5ba - <rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind as rustc_query_system[b885f6fe60382e2e]::dep_graph::DepKind>::with_deps::<<rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (rustc_span[2625accf23a29991]::def_id::LocalDefId, rustc_span[2625accf23a29991]::def_id::DefId), &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>::{closure#0}, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  42:        0x11df50d42 - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (rustc_span[2625accf23a29991]::def_id::LocalDefId, rustc_span[2625accf23a29991]::def_id::DefId), &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  43:        0x11dc650a1 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<(rustc_span[2625accf23a29991]::def_id::LocalDefId, rustc_span[2625accf23a29991]::def_id::DefId), &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>>
  44:        0x11dd3ac7d - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::typeck_const_arg, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  45:        0x11ddd33e7 - <rustc_query_impl[cfd1e86cd19618c3]::Queries as rustc_middle[fc7ebf79883dfa5a]::ty::query::QueryEngine>::typeck_const_arg
  46:        0x11cc867ba - rustc_hir_typeck[6a8d7b4346cd089d]::typeck
  47:        0x11df1fa2f - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, rustc_span[2625accf23a29991]::def_id::LocalDefId, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>
  48:        0x11dcb8f0e - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::VecCache<rustc_span[2625accf23a29991]::def_id::LocalDefId, &rustc_middle[fc7ebf79883dfa5a]::ty::context::TypeckResults>>
  49:        0x11dd4a314 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::typeck, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  50:        0x11ccfa49a - std[3161060b00c850ea]::panicking::try::<(), core[36719e2ca9cc5cdf]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[5322186b9ea74ad0]::sync::par_for_each_in<&[rustc_span[2625accf23a29991]::def_id::LocalDefId], <rustc_middle[fc7ebf79883dfa5a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>>
  51:        0x11ccfa695 - rustc_data_structures[5322186b9ea74ad0]::sync::par_for_each_in::<&[rustc_span[2625accf23a29991]::def_id::LocalDefId], <rustc_middle[fc7ebf79883dfa5a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[6a8d7b4346cd089d]::typeck_item_bodies::{closure#0}>::{closure#0}>
  52:        0x11cc859cd - rustc_hir_typeck[6a8d7b4346cd089d]::typeck_item_bodies
  53:        0x11df63cf6 - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (), ()>
  54:        0x11dc91839 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<(), ()>>
  55:        0x11dd3d191 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::typeck_item_bodies, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  56:        0x11cdeadfe - <rustc_session[6d4ac4b3b9abdb4d]::session::Session>::time::<(), rustc_hir_analysis[bf6ee3453ce961c4]::check_crate::{closure#7}>
  57:        0x11ce31435 - rustc_hir_analysis[bf6ee3453ce961c4]::check_crate
  58:        0x11a45348a - rustc_interface[22d5e9ac326097ba]::passes::analysis
  59:        0x11df56b36 - <rustc_query_system[b885f6fe60382e2e]::dep_graph::graph::DepGraph<rustc_middle[fc7ebf79883dfa5a]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[fc7ebf79883dfa5a]::ty::context::TyCtxt, (), core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  60:        0x11dc802a7 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::try_execute_query::<rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt, rustc_query_system[b885f6fe60382e2e]::query::caches::DefaultCache<(), core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>>
  61:        0x11dd4a6f1 - rustc_query_system[b885f6fe60382e2e]::query::plumbing::get_query::<rustc_query_impl[cfd1e86cd19618c3]::queries::analysis, rustc_query_impl[cfd1e86cd19618c3]::plumbing::QueryCtxt>
  62:        0x11a303ab3 - <rustc_interface[22d5e9ac326097ba]::passes::QueryContext>::enter::<rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  63:        0x11a34ae32 - rustc_span[2625accf23a29991]::with_source_map::<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  64:        0x11a33ce6d - <scoped_tls[b2500c2140549217]::ScopedKey<rustc_span[2625accf23a29991]::SessionGlobals>>::set::<rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  65:        0x11a30c9aa - std[3161060b00c850ea]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[22d5e9ac326097ba]::util::run_in_thread_pool_with_globals<rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>
  66:        0x11a2eeaf5 - <<std[3161060b00c850ea]::thread::Builder>::spawn_unchecked_<rustc_interface[22d5e9ac326097ba]::util::run_in_thread_pool_with_globals<rustc_interface[22d5e9ac326097ba]::interface::run_compiler<core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>, rustc_driver[8e093e25fe36b41b]::run_compiler::{closure#1}>::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[36719e2ca9cc5cdf]::result::Result<(), rustc_errors[8823badf17c9d4b2]::ErrorGuaranteed>>::{closure#1} as core[36719e2ca9cc5cdf]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  67:        0x10aaf8437 - std::sys::unix::thread::Thread::new::thread_start::he272a3f7edb058e0
  68:     0x7ff80544d4e1 - __pthread_start

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.67.1 (d5a82bbd2 2023-02-07) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
thread panicked while processing panic. aborting.
warning: `all-is-cubes` (lib) generated 1 warning
error: could not compile `all-is-cubes`; 1 warning emitted

@rustbot label +A-incr-comp

@kpreid kpreid 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 Feb 26, 2023
@rustbot rustbot added the A-incr-comp Area: Incremental compilation label Feb 26, 2023
@kpreid
Copy link
Contributor Author

kpreid commented Feb 26, 2023

On looking more closely at the backtrace, it seems that this error results from attempting to load corrupted (truncated) query cache files, and therefore it would be valuable to obtain a trace from the file having been written (assuming that they are truncated due to a panic during write; if they're silently corrupted that's even harder to notice).

I will update this issue if I manage to catch such a case.

@kpreid
Copy link
Contributor Author

kpreid commented Feb 26, 2023

Looking at the first panic observed since a cargo clean and it is still the above index out of bounds in <Span as Decodable>::decode, so it's not that I missed the writing event but that it didn't panic.

@kpreid
Copy link
Contributor Author

kpreid commented Mar 26, 2023

I have made some progress on reproducing the problem with a minimal incremental change (but not yet a minimal standalone code sample), and @Nilstrieb expressed some interest in looking at the problem, so I've published branches with the work I have so far. Repro steps:

  1. Checkout https://github.com/kpreid/all-is-cubes/tree/ice-base
  2. cargo clean -p all-is-cubes
  3. cargo build -p all-is-cubes
  4. Checkout https://github.com/kpreid/all-is-cubes/tree/ice-reduce
  5. cargo build -p all-is-cubes

The second build will ICE.

The differences between the two branches are shuffling code between modules, adding a module, and deleting a module; the code in them is as identical as it can be.

@Noratrieb
Copy link
Member

Noratrieb commented Mar 27, 2023

Note: I cannot reproduce this ICE on x86_64-unknown-linux-gnu with the latest nightly by default, but -Zincremental-verify-ich makes it ICE.

backtrace
error: internal compiler error: encountered incremental compilation error with def_span(all_is_cubes[1daa]::mesh::chunked_mesh::{impl#6}::{constant#0})
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p all_is_cubes` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https://github.com/rust-lang/rust/issues/84970> for more information

thread 'rustc' panicked at 'Found unstable fingerprints for ErrorGuaranteed(()): all-is-cubes/src/mesh/chunked_mesh.rs:40:71: 41:5 (#0)', /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/compiler/rustc_query_system/src/query/plumbing.rs:711:9
stack backtrace:
   0:     0x7f307ba99baa - std::backtrace_rs::backtrace::libunwind::trace::h9d4d46a1241d4149
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f307ba99baa - std::backtrace_rs::backtrace::trace_unsynchronized::h1d977e0ccdc95d1a
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f307ba99baa - std::sys_common::backtrace::_print_fmt::h2f16d6748c69c3cb
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f307ba99baa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h23aff7f8c54e6645
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f307bafdb4f - core::fmt::write::h79726c2a902099f4
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f307ba8c7e5 - std::io::Write::write_fmt::h95eedad6917eaf86
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/io/mod.rs:1698:15
   6:     0x7f307ba99975 - std::sys_common::backtrace::_print::h24fa32acab53acd8
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f307ba99975 - std::sys_common::backtrace::print::h94b47d816d0ea14c
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f307ba9c61e - std::panicking::default_hook::{{closure}}::h3bfad4b8b9ac0389
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:271:22
   9:     0x7f307ba9c3c5 - std::panicking::default_hook::hd7b308d8bc779cf9
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:290:9
  10:     0x7f307ed41e85 - <rustc_driver_impl[2b818a379abe8476]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[4ada38e0d5cae8be]::ops::function::FnOnce<(&core[4ada38e0d5cae8be]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f307ba9ce14 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hca7afd504fdadbfc
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/alloc/src/boxed.rs:2002:9
  12:     0x7f307ba9ce14 - std::panicking::rust_panic_with_hook::hcec224f40e508f49
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:696:13
  13:     0x7f307ba9cb89 - std::panicking::begin_panic_handler::{{closure}}::habd506011d7d1786
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:583:13
  14:     0x7f307ba9a016 - std::sys_common::backtrace::__rust_end_short_backtrace::h85b86f25ce9045f3
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f307ba9c8e2 - rust_begin_unwind
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/panicking.rs:579:5
  16:     0x7f307baf9f53 - core::panicking::panic_fmt::hb2cfa4c0db12cc76
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/core/src/panicking.rs:67:14
  17:     0x7f307f5e0770 - rustc_query_system[131b14eb042ddf12]::query::plumbing::incremental_verify_ich_failed::<rustc_middle[344b7a5778ebfb41]::ty::context::TyCtxt>
  18:     0x7f307d56ced6 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::<rustc_query_impl[11434efd0e0628d5]::queries::def_span, rustc_query_impl[11434efd0e0628d5]::plumbing::QueryCtxt>
  19:     0x7f307ccf82f6 - rustc_ty_utils[354017f06c94058c]::ty::param_env
  20:     0x7f307ccf6288 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::<rustc_query_impl[11434efd0e0628d5]::queries::param_env, rustc_query_impl[11434efd0e0628d5]::plumbing::QueryCtxt>
  21:     0x7f307ccf5906 - <rustc_query_impl[11434efd0e0628d5]::Queries as rustc_middle[344b7a5778ebfb41]::ty::query::QueryEngine>::param_env
  22:     0x7f307e2b2040 - rustc_hir_typeck[66b9761b95fd1136]::typeck_const_arg
  23:     0x7f307e1989b8 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::<rustc_query_impl[11434efd0e0628d5]::queries::typeck_const_arg, rustc_query_impl[11434efd0e0628d5]::plumbing::QueryCtxt>
  24:     0x7f307e1982e4 - <rustc_query_impl[11434efd0e0628d5]::Queries as rustc_middle[344b7a5778ebfb41]::ty::query::QueryEngine>::typeck_const_arg
  25:     0x7f307dde3d53 - rustc_hir_typeck[66b9761b95fd1136]::typeck
  26:     0x7f307dbcd79b - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::<rustc_query_impl[11434efd0e0628d5]::queries::typeck, rustc_query_impl[11434efd0e0628d5]::plumbing::QueryCtxt>
  27:     0x7f307e49e14b - rustc_data_structures[3749598f95b8ed78]::sync::par_for_each_in::<&[rustc_span[d779338a88541528]::def_id::LocalDefId], <rustc_middle[344b7a5778ebfb41]::hir::map::Map>::par_body_owners<rustc_hir_typeck[66b9761b95fd1136]::typeck_item_bodies::{closure#0}>::{closure#0}>
  28:     0x7f307e49df1f - rustc_hir_typeck[66b9761b95fd1136]::typeck_item_bodies
  29:     0x7f307e50e2fd - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::<rustc_query_impl[11434efd0e0628d5]::queries::typeck_item_bodies, rustc_query_impl[11434efd0e0628d5]::plumbing::QueryCtxt>
  30:     0x7f307e50dd5c - <rustc_query_impl[11434efd0e0628d5]::Queries as rustc_middle[344b7a5778ebfb41]::ty::query::QueryEngine>::typeck_item_bodies
  31:     0x7f307e1e591f - <rustc_session[53edf0328176f526]::session::Session>::time::<(), rustc_hir_analysis[1b62eb4aa9e52db3]::check_crate::{closure#7}>
  32:     0x7f307e1e22c7 - rustc_hir_analysis[1b62eb4aa9e52db3]::check_crate
  33:     0x7f307e1dc511 - rustc_interface[cc30d76fa8dae5fc]::passes::analysis
  34:     0x7f307e505810 - rustc_query_system[131b14eb042ddf12]::query::plumbing::try_execute_query::<rustc_query_impl[11434efd0e0628d5]::queries::analysis, rustc_query_impl[11434efd0e0628d5]::plumbing::QueryCtxt>
  35:     0x7f307e5052f0 - <rustc_query_impl[11434efd0e0628d5]::Queries as rustc_middle[344b7a5778ebfb41]::ty::query::QueryEngine>::analysis
  36:     0x7f307e389089 - <rustc_middle[344b7a5778ebfb41]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>
  37:     0x7f307deb1e01 - <rustc_interface[cc30d76fa8dae5fc]::interface::Compiler>::enter::<rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}::{closure#2}, core[4ada38e0d5cae8be]::result::Result<core[4ada38e0d5cae8be]::option::Option<rustc_interface[cc30d76fa8dae5fc]::queries::Linker>, rustc_span[d779338a88541528]::ErrorGuaranteed>>
  38:     0x7f307deaffb1 - rustc_span[d779338a88541528]::with_source_map::<core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>, rustc_interface[cc30d76fa8dae5fc]::interface::run_compiler<core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>, rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  39:     0x7f307deaf55f - std[d743b6fa88cd7a4c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[cc30d76fa8dae5fc]::util::run_in_thread_pool_with_globals<rustc_interface[cc30d76fa8dae5fc]::interface::run_compiler<core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>, rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}>::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>
  40:     0x7f307e5ea52e - <<std[d743b6fa88cd7a4c]::thread::Builder>::spawn_unchecked_<rustc_interface[cc30d76fa8dae5fc]::util::run_in_thread_pool_with_globals<rustc_interface[cc30d76fa8dae5fc]::interface::run_compiler<core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>, rustc_driver_impl[2b818a379abe8476]::run_compiler::{closure#1}>::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ada38e0d5cae8be]::result::Result<(), rustc_span[d779338a88541528]::ErrorGuaranteed>>::{closure#1} as core[4ada38e0d5cae8be]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7f307baa6f15 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h843c8319f93d5fbd
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/alloc/src/boxed.rs:1988:9
  42:     0x7f307baa6f15 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9f6cdb354bbcea1a
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/alloc/src/boxed.rs:1988:9
  43:     0x7f307baa6f15 - std::sys::unix::thread::Thread::new::thread_start::h53e32c182a23b75f
                               at /rustc/db0cbc48d4aaa300713a95d9b317a365a474490c/library/std/src/sys/unix/thread.rs:108:17
  44:     0x7f307b7e9b43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  45:     0x7f307b87ba00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  46:                0x0 - <unknown>

error: 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.70.0-nightly (db0cbc48d 2023-03-26) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=2 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C linker=clang -C incremental=[REDACTED] -Z incremental-verify-ich=yes

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

query stack during panic:

@Noratrieb
Copy link
Member

I've created a new branch which slighly simplifies the diff application: https://github.com/Nilstrieb/all-is-cubes/tree/try (bb8f36b at the time of writing).

@michaelwoerister
Copy link
Member

I've tried to find out a bit more about this, but didn't get very far. From what I can tell:

  • In the second session all_is_cubes[1daa]::mesh::chunked_mesh::{impl#6} refers to the derived Debug impl for ChunkedSpaceMesh. And all_is_cubes[1daa]::mesh::chunked_mesh::{impl#6}::{constant#0} refers to the CHUNK_SIZE const generic of that impl. It has the span of the CHUNK_SIZE const generic of the ChunkedSpaceMesh type definition.
  • In the first session, as far as I can tell, the def-path all_is_cubes[1daa]::mesh::chunked_mesh::{impl#6} refers to the inherent impl of TodoListener, which also has a CHUNK_SIZE generic const.

The def_span(all_is_cubes[1daa]::mesh::chunked_mesh::{impl#6}::{constant#0}) query should not evaluate to green, but for some reason all of its dependencies are marked as green.

@michaelwoerister
Copy link
Member

Maybe -Zdump-dep-graph is too broken (it needed some fixing to show more than just DepKinds), but is it possible that def_span(all_is_cubes[1daa]::mesh::chunked_mesh::{impl#6}::{constant#0}) has no dependencies at all during the first session?

@michaelwoerister
Copy link
Member

It does indeed have no dependencies. I imagine that this is the culprit:

TaskDepsRef::Ignore => {} // During HIR lowering, we have no dependencies.

I'm not really up-to-date with query feeding but this looks fishy. When a dep-node has no dependencies, it will trivially evaluate to green. Don't we need at least a dependency on the query that does the feeding?

cc @oli-obk & @cjgillot

@kpreid
Copy link
Contributor Author

kpreid commented Mar 30, 2023

Given what we've learned about this bug, it's likely that this is purely about incremental compilation cache keying, i.e. neither state of the code is more likely to be miscompiled than the other, right? In other words, I as the author of the original code probably don't need to worry that I'm making my compiled code less reliable if I make the change that caused the ICE, as long as I cargo clean after that point?

@michaelwoerister
Copy link
Member

Yes, as far as I can tell, this is a bug in incremental compilation's dependency tracking and does not affect non-incremental builds.

@Noratrieb
Copy link
Member

Hey, I'm back with a repro! Thanks go out to cargo-minimize, without which I would have never been able to minimize this.

A one-command minimization is available at Noratrieb/all-is-cubes@feaf3c0 with ./minimize.sh. Basically:

-Zincremental-verify-ich must be enabled.

use std::fmt::Debug;

#[derive(Debug)] // I am not able to expand this derive.
pub struct ConstGeneric<const CHUNK_SIZE: usize> {
    _p: [(); CHUNK_SIZE],
}

/////// MOVE START
impl<const CHUNK_SIZE: usize> ConstGeneric<CHUNK_SIZE> {}
/////// MOVE END

Running cargo check.
Then applying

diff --git a/src/lib.rs b/src/lib.rs
index 19b10697..c51f498e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,6 +5,4 @@ pub struct ConstGeneric<const CHUNK_SIZE: usize> {
     _p: [(); CHUNK_SIZE],
 }

-/////// MOVE START
-impl<const CHUNK_SIZE: usize> ConstGeneric<CHUNK_SIZE> {}
 /////// MOVE END

Then running cargo check again panics.

error: internal compiler error: encountered incremental compilation error with def_span(all_is_cubes[456c]::{impl#0}::{constant#0})
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p all_is_cubes` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https://github.com/rust-lang/rust/issues/84970> for more information

thread 'rustc' panicked at 'Found unstable fingerprints for def_span(all_is_cubes[456c]::{impl#0}::{constant#0}): src/lib.rs:3:53: 4:6 (#0)', /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/compiler/rustc_query_system/src/query/plumbing.rs:710:9
stack backtrace:
   0:     0x7f2501bbdf8a - std::backtrace_rs::backtrace::libunwind::trace::h2f1b14d2b9e4c6b4
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f2501bbdf8a - std::backtrace_rs::backtrace::trace_unsynchronized::haf404d9184796f09
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2501bbdf8a - std::sys_common::backtrace::_print_fmt::h440840d8524e88f8
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f2501bbdf8a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0d5b0c2d97b8992f
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f2501c2205f - core::fmt::write::h63211a72e96d0d74
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f2501bb0bc5 - std::io::Write::write_fmt::h83a6589baaeb8174
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/io/mod.rs:1698:15
   6:     0x7f2501bbdd55 - std::sys_common::backtrace::_print::h188e467357108441
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f2501bbdd55 - std::sys_common::backtrace::print::ha9da41b42961a865
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f2501bc09fe - std::panicking::default_hook::{{closure}}::h3fe2eceaaddaab65
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:269:22
   9:     0x7f2501bc07a5 - std::panicking::default_hook::h0c19eee30e1bb21a
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:288:9
  10:     0x7f2504ec34d5 - <rustc_driver_impl[be27ae895c9c1abf]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[633911572d8bda32]::ops::function::FnOnce<(&core[633911572d8bda32]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f2501bc11f4 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc01893d2c4f83c85
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1990:9
  12:     0x7f2501bc11f4 - std::panicking::rust_panic_with_hook::hce3464c8b95f72d6
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:694:13
  13:     0x7f2501bc0f69 - std::panicking::begin_panic_handler::{{closure}}::h8b73e8ac2e39f738
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:581:13
  14:     0x7f2501bbe3f6 - std::sys_common::backtrace::__rust_end_short_backtrace::h0437dc11b8a6708e
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f2501bc0cc2 - rust_begin_unwind
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:577:5
  16:     0x7f2501c1e373 - core::panicking::panic_fmt::h27c352b46a87a69b
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/panicking.rs:67:14
  17:     0x7f2505759fcc - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::incremental_verify_ich_failed::<rustc_middle[2e01d9c02d9244ae]::ty::context::TyCtxt>
  18:     0x7f25037d635a - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#1}, core[633911572d8bda32]::option::Option<(rustc_span[9d027ba2263b9410]::span_encoding::Span, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>>::{closure#0}, core[633911572d8bda32]::option::Option<(rustc_span[9d027ba2263b9410]::span_encoding::Span, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>>
  19:     0x7f25037d48c7 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  20:     0x7f2502e1f506 - rustc_ty_utils[43839840c81ed713]::ty::param_env
  21:     0x7f2502e22676 - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::param_env, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (rustc_middle[2e01d9c02d9244ae]::ty::ParamEnv, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle[2e01d9c02d9244ae]::ty::ParamEnv, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  22:     0x7f2502e1dfba - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::param_env, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  23:     0x7f2502e1d766 - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::param_env
  24:     0x7f250435e5b0 - rustc_hir_typeck[1db604f76e28b20e]::typeck_const_arg
  25:     0x7f25042f3b62 - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_const_arg, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  26:     0x7f25042f30df - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_const_arg, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  27:     0x7f25042f2ad4 - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::typeck_const_arg
  28:     0x7f2503f76384 - rustc_hir_typeck[1db604f76e28b20e]::typeck
  29:     0x7f2502fe6592 - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::typeck, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  30:     0x7f2502fdb290 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::typeck, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  31:     0x7f25045fbd3b - rustc_data_structures[6ef3f1b9ef542b16]::sync::par_for_each_in::<&[rustc_span[9d027ba2263b9410]::def_id::LocalDefId], <rustc_middle[2e01d9c02d9244ae]::hir::map::Map>::par_body_owners<rustc_hir_typeck[1db604f76e28b20e]::typeck_item_bodies::{closure#0}>::{closure#0}>
  32:     0x7f25045fbb0f - rustc_hir_typeck[1db604f76e28b20e]::typeck_item_bodies
  33:     0x7f250467006d - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_item_bodies, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, ((), rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, ((), rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  34:     0x7f250466f82b - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_item_bodies, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  35:     0x7f250466f34c - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::typeck_item_bodies
  36:     0x7f25042ef41f - <rustc_session[2115a9ee57a65798]::session::Session>::time::<(), rustc_hir_analysis[d8584a28d0f23821]::check_crate::{closure#7}>
  37:     0x7f25042ed0c7 - rustc_hir_analysis[d8584a28d0f23821]::check_crate
  38:     0x7f25042e7211 - rustc_interface[fa1cd19e003fbde7]::passes::analysis
  39:     0x7f250466d23a - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::analysis, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  40:     0x7f250466cd8f - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::analysis, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  41:     0x7f250466c8f0 - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::analysis
  42:     0x7f25040ee54e - <rustc_interface[fa1cd19e003fbde7]::queries::QueryResult<&rustc_middle[2e01d9c02d9244ae]::ty::context::GlobalCtxt>>::enter::<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  43:     0x7f25040ed02e - <rustc_interface[fa1cd19e003fbde7]::interface::Compiler>::enter::<rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}::{closure#2}, core[633911572d8bda32]::result::Result<core[633911572d8bda32]::option::Option<rustc_interface[fa1cd19e003fbde7]::queries::Linker>, rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>
  44:     0x7f25040eb1e1 - rustc_span[9d027ba2263b9410]::set_source_map::<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_interface[fa1cd19e003fbde7]::interface::run_compiler<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  45:     0x7f25040ea78f - std[5eb8f1edb78db018]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[fa1cd19e003fbde7]::util::run_in_thread_pool_with_globals<rustc_interface[fa1cd19e003fbde7]::interface::run_compiler<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}>::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>
  46:     0x7f25040ea16e - <<std[5eb8f1edb78db018]::thread::Builder>::spawn_unchecked_<rustc_interface[fa1cd19e003fbde7]::util::run_in_thread_pool_with_globals<rustc_interface[fa1cd19e003fbde7]::interface::run_compiler<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}>::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>::{closure#1} as core[633911572d8bda32]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7f2501bcb2d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf8dc8be554bcb253
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1976:9
  48:     0x7f2501bcb2d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7ce91a4bb123291d
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1976:9
  49:     0x7f2501bcb2d5 - std::sys::unix::thread::Thread::new::thread_start::h821bdfe2a1422348
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys/unix/thread.rs:108:17
  50:     0x7f250190db43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  51:     0x7f250199fa00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  52:                0x0 - <unknown>

error: 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.70.0-nightly (5e1d3299a 2023-03-31) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -Z incremental-verify-ich

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

query stack during panic:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/compiler/rustc_query_system/src/query/job.rs:47:24
stack backtrace:
   0:     0x7f2501bbdf8a - std::backtrace_rs::backtrace::libunwind::trace::h2f1b14d2b9e4c6b4
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f2501bbdf8a - std::backtrace_rs::backtrace::trace_unsynchronized::haf404d9184796f09
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2501bbdf8a - std::sys_common::backtrace::_print_fmt::h440840d8524e88f8
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f2501bbdf8a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0d5b0c2d97b8992f
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f2501c2205f - core::fmt::write::h63211a72e96d0d74
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f2501bb0bc5 - std::io::Write::write_fmt::h83a6589baaeb8174
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/io/mod.rs:1698:15
   6:     0x7f2501bbdd55 - std::sys_common::backtrace::_print::h188e467357108441
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f2501bbdd55 - std::sys_common::backtrace::print::ha9da41b42961a865
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f2501bc09fe - std::panicking::default_hook::{{closure}}::h3fe2eceaaddaab65
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:269:22
   9:     0x7f2501bc07a5 - std::panicking::default_hook::h0c19eee30e1bb21a
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:288:9
  10:     0x7f2504ec34d5 - <rustc_driver_impl[be27ae895c9c1abf]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[633911572d8bda32]::ops::function::FnOnce<(&core[633911572d8bda32]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f2501bc11f4 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc01893d2c4f83c85
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1990:9
  12:     0x7f2501bc11f4 - std::panicking::rust_panic_with_hook::hce3464c8b95f72d6
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:694:13
  13:     0x7f2501bc0f22 - std::panicking::begin_panic_handler::{{closure}}::h8b73e8ac2e39f738
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:579:13
  14:     0x7f2501bbe3f6 - std::sys_common::backtrace::__rust_end_short_backtrace::h0437dc11b8a6708e
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f2501bc0cc2 - rust_begin_unwind
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:577:5
  16:     0x7f2501c1e373 - core::panicking::panic_fmt::h27c352b46a87a69b
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/panicking.rs:67:14
  17:     0x7f2501c1e40d - core::panicking::panic::h263133906bfb9076
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/panicking.rs:117:5
  18:     0x7f25057ab7f3 - <rustc_query_system[bcefc4dc53f73d2]::query::job::QueryJobId>::find_cycle_in_stack::<rustc_middle[2e01d9c02d9244ae]::dep_graph::dep_node::DepKind>
  19:     0x7f25057274fd - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::cycle_error::<rustc_query_impl[a11cf9e729a76afa]::queries::source_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  20:     0x7f25037d4f09 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  21:     0x7f25037d397a - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::def_span
  22:     0x7f25053f30f4 - <rustc_span[9d027ba2263b9410]::def_id::DefId as rustc_middle[2e01d9c02d9244ae]::query::keys::Key>::default_span
  23:     0x7f250583ec1e - rustc_query_impl[a11cf9e729a76afa]::plumbing::create_query_frame::<rustc_span[9d027ba2263b9410]::def_id::DefId>
  24:     0x7f250579cc59 - <rustc_query_impl[a11cf9e729a76afa]::query_structs::param_env::{closure#0}::{closure#0} as core[633911572d8bda32]::ops::function::FnOnce<(rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt, rustc_span[9d027ba2263b9410]::def_id::DefId)>>::call_once
  25:     0x7f250572365c - <rustc_query_system[bcefc4dc53f73d2]::query::plumbing::QueryState<rustc_span[9d027ba2263b9410]::def_id::DefId, rustc_middle[2e01d9c02d9244ae]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  26:     0x7f250581a232 - <rustc_query_impl[a11cf9e729a76afa]::Queries>::try_collect_active_jobs
  27:     0x7f25057274b4 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::cycle_error::<rustc_query_impl[a11cf9e729a76afa]::queries::source_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  28:     0x7f25037d4f09 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  29:     0x7f25037d397a - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::def_span
  30:     0x7f25053f30f4 - <rustc_span[9d027ba2263b9410]::def_id::DefId as rustc_middle[2e01d9c02d9244ae]::query::keys::Key>::default_span
  31:     0x7f250584084f - rustc_query_impl[a11cf9e729a76afa]::plumbing::create_query_frame::<(rustc_span[9d027ba2263b9410]::def_id::LocalDefId, rustc_span[9d027ba2263b9410]::def_id::DefId)>
  32:     0x7f2505799db4 - <rustc_query_impl[a11cf9e729a76afa]::query_structs::typeck_const_arg::{closure#0}::{closure#0} as core[633911572d8bda32]::ops::function::FnOnce<(rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt, (rustc_span[9d027ba2263b9410]::def_id::LocalDefId, rustc_span[9d027ba2263b9410]::def_id::DefId))>>::call_once
  33:     0x7f2505724f10 - <rustc_query_system[bcefc4dc53f73d2]::query::plumbing::QueryState<(rustc_span[9d027ba2263b9410]::def_id::LocalDefId, rustc_span[9d027ba2263b9410]::def_id::DefId), rustc_middle[2e01d9c02d9244ae]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  34:     0x7f250581a232 - <rustc_query_impl[a11cf9e729a76afa]::Queries>::try_collect_active_jobs
  35:     0x7f25057274b4 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::cycle_error::<rustc_query_impl[a11cf9e729a76afa]::queries::source_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  36:     0x7f25037d4f09 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  37:     0x7f25037d397a - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::def_span
  38:     0x7f25053f30f4 - <rustc_span[9d027ba2263b9410]::def_id::DefId as rustc_middle[2e01d9c02d9244ae]::query::keys::Key>::default_span
  39:     0x7f250583e8af - rustc_query_impl[a11cf9e729a76afa]::plumbing::create_query_frame::<rustc_hir[d510e89e73515c9b]::hir_id::OwnerId>
  40:     0x7f250579c833 - <rustc_query_impl[a11cf9e729a76afa]::query_structs::typeck::{closure#0}::{closure#0} as core[633911572d8bda32]::ops::function::FnOnce<(rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt, rustc_span[9d027ba2263b9410]::def_id::LocalDefId)>>::call_once
  41:     0x7f25057234f1 - <rustc_query_system[bcefc4dc53f73d2]::query::plumbing::QueryState<rustc_span[9d027ba2263b9410]::def_id::LocalDefId, rustc_middle[2e01d9c02d9244ae]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  42:     0x7f250581a232 - <rustc_query_impl[a11cf9e729a76afa]::Queries>::try_collect_active_jobs
  43:     0x7f25057ad057 - rustc_query_system[bcefc4dc53f73d2]::query::job::print_query_stack::<rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  44:     0x7f2505274c98 - rustc_interface[fa1cd19e003fbde7]::interface::try_print_query_stack
  45:     0x7f2504ec58fd - rustc_driver_impl[be27ae895c9c1abf]::report_ice
  46:     0x7f2504ec351c - <rustc_driver_impl[be27ae895c9c1abf]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[633911572d8bda32]::ops::function::FnOnce<(&core[633911572d8bda32]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  47:     0x7f2501bc11f4 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc01893d2c4f83c85
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1990:9
  48:     0x7f2501bc11f4 - std::panicking::rust_panic_with_hook::hce3464c8b95f72d6
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:694:13
  49:     0x7f2501bc0f69 - std::panicking::begin_panic_handler::{{closure}}::h8b73e8ac2e39f738
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:581:13
  50:     0x7f2501bbe3f6 - std::sys_common::backtrace::__rust_end_short_backtrace::h0437dc11b8a6708e
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys_common/backtrace.rs:150:18
  51:     0x7f2501bc0cc2 - rust_begin_unwind
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/panicking.rs:577:5
  52:     0x7f2501c1e373 - core::panicking::panic_fmt::h27c352b46a87a69b
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/core/src/panicking.rs:67:14
  53:     0x7f2505759fcc - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::incremental_verify_ich_failed::<rustc_middle[2e01d9c02d9244ae]::ty::context::TyCtxt>
  54:     0x7f25037d635a - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#1}, core[633911572d8bda32]::option::Option<(rustc_span[9d027ba2263b9410]::span_encoding::Span, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>>::{closure#0}, core[633911572d8bda32]::option::Option<(rustc_span[9d027ba2263b9410]::span_encoding::Span, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>>
  55:     0x7f25037d48c7 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::def_span, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  56:     0x7f2502e1f506 - rustc_ty_utils[43839840c81ed713]::ty::param_env
  57:     0x7f2502e22676 - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::param_env, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (rustc_middle[2e01d9c02d9244ae]::ty::ParamEnv, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle[2e01d9c02d9244ae]::ty::ParamEnv, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  58:     0x7f2502e1dfba - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::param_env, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  59:     0x7f2502e1d766 - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::param_env
  60:     0x7f250435e5b0 - rustc_hir_typeck[1db604f76e28b20e]::typeck_const_arg
  61:     0x7f25042f3b62 - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_const_arg, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  62:     0x7f25042f30df - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_const_arg, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  63:     0x7f25042f2ad4 - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::typeck_const_arg
  64:     0x7f2503f76384 - rustc_hir_typeck[1db604f76e28b20e]::typeck
  65:     0x7f2502fe6592 - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::typeck, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (&rustc_middle[2e01d9c02d9244ae]::ty::typeck_results::TypeckResults, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  66:     0x7f2502fdb290 - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::typeck, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  67:     0x7f25045fbd3b - rustc_data_structures[6ef3f1b9ef542b16]::sync::par_for_each_in::<&[rustc_span[9d027ba2263b9410]::def_id::LocalDefId], <rustc_middle[2e01d9c02d9244ae]::hir::map::Map>::par_body_owners<rustc_hir_typeck[1db604f76e28b20e]::typeck_item_bodies::{closure#0}>::{closure#0}>
  68:     0x7f25045fbb0f - rustc_hir_typeck[1db604f76e28b20e]::typeck_item_bodies
  69:     0x7f250467006d - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_item_bodies, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, ((), rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, ((), rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  70:     0x7f250466f82b - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::typeck_item_bodies, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  71:     0x7f250466f34c - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::typeck_item_bodies
  72:     0x7f25042ef41f - <rustc_session[2115a9ee57a65798]::session::Session>::time::<(), rustc_hir_analysis[d8584a28d0f23821]::check_crate::{closure#7}>
  73:     0x7f25042ed0c7 - rustc_hir_analysis[d8584a28d0f23821]::check_crate
  74:     0x7f25042e7211 - rustc_interface[fa1cd19e003fbde7]::passes::analysis
  75:     0x7f250466d23a - <std[5eb8f1edb78db018]::thread::local::LocalKey<core[633911572d8bda32]::cell::Cell<*const ()>>>::with::<rustc_middle[2e01d9c02d9244ae]::ty::context::tls::enter_context<rustc_query_system[bcefc4dc53f73d2]::query::plumbing::execute_job_incr<rustc_query_impl[a11cf9e729a76afa]::queries::analysis, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>::{closure#2}, (core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_query_system[bcefc4dc53f73d2]::dep_graph::graph::DepNodeIndex)>
  76:     0x7f250466cd8f - rustc_query_system[bcefc4dc53f73d2]::query::plumbing::try_execute_query::<rustc_query_impl[a11cf9e729a76afa]::queries::analysis, rustc_query_impl[a11cf9e729a76afa]::plumbing::QueryCtxt>
  77:     0x7f250466c8f0 - <rustc_query_impl[a11cf9e729a76afa]::Queries as rustc_middle[2e01d9c02d9244ae]::ty::query::QueryEngine>::analysis
  78:     0x7f25040ee54e - <rustc_interface[fa1cd19e003fbde7]::queries::QueryResult<&rustc_middle[2e01d9c02d9244ae]::ty::context::GlobalCtxt>>::enter::<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  79:     0x7f25040ed02e - <rustc_interface[fa1cd19e003fbde7]::interface::Compiler>::enter::<rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}::{closure#2}, core[633911572d8bda32]::result::Result<core[633911572d8bda32]::option::Option<rustc_interface[fa1cd19e003fbde7]::queries::Linker>, rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>
  80:     0x7f25040eb1e1 - rustc_span[9d027ba2263b9410]::set_source_map::<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_interface[fa1cd19e003fbde7]::interface::run_compiler<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  81:     0x7f25040ea78f - std[5eb8f1edb78db018]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[fa1cd19e003fbde7]::util::run_in_thread_pool_with_globals<rustc_interface[fa1cd19e003fbde7]::interface::run_compiler<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}>::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>
  82:     0x7f25040ea16e - <<std[5eb8f1edb78db018]::thread::Builder>::spawn_unchecked_<rustc_interface[fa1cd19e003fbde7]::util::run_in_thread_pool_with_globals<rustc_interface[fa1cd19e003fbde7]::interface::run_compiler<core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>, rustc_driver_impl[be27ae895c9c1abf]::run_compiler::{closure#1}>::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[633911572d8bda32]::result::Result<(), rustc_span[9d027ba2263b9410]::ErrorGuaranteed>>::{closure#1} as core[633911572d8bda32]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  83:     0x7f2501bcb2d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf8dc8be554bcb253
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1976:9
  84:     0x7f2501bcb2d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7ce91a4bb123291d
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/alloc/src/boxed.rs:1976:9
  85:     0x7f2501bcb2d5 - std::sys::unix::thread::Thread::new::thread_start::h821bdfe2a1422348
                               at /rustc/5e1d3299a290026b85787bc9c7e72bcc53ac283f/library/std/src/sys/unix/thread.rs:108:17
  86:     0x7f250190db43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  87:     0x7f250199fa00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  88:                0x0 - <unknown>

error: 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.70.0-nightly (5e1d3299a 2023-03-31) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -Z incremental-verify-ich

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

query stack during panic:
#0 [def_span] looking up span for `<impl at src/lib.rs:3:10: 3:15>::{constant#0}`
end of query stack
thread panicked while panicking. aborting.
error: could not compile `all-is-cubes` (lib) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name all_is_cubes --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=209 --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=ce9a0cbf1d21f99c -C extra-filename=-ce9a0cbf1d21f99c --out-dir /home/nilsh/other/all-is-cubes/target/debug/deps -C linker=clang -C incremental=/home/nilsh/other/all-is-cubes/target/debug/incremental -L dependency=/home/nilsh/other/all-is-cubes/target/debug/deps -Zincremental-verify-ich` (signal: 6, SIGABRT: process abort signal)

For some strange reason I am unable to reproduce the changes when applying the diff in vscode via WSL. git apply and vim work though.

@Noratrieb Noratrieb added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Apr 1, 2023
@Noratrieb
Copy link
Member

I will unassign myself as I mostly assigned myself for the MCVE.

@Noratrieb Noratrieb removed their assignment Apr 1, 2023
@michaelwoerister
Copy link
Member

It looks like some things, like lowering to HIR, are run within a TaskDepsRef::Ignore context, which leads to this dep_graph.read_index(DepNodeIndex::FOREVER_RED_NODE) call being ignored too -- and thus never making it into the TaskDepsRef we are trying to duplicate during DepGraph::with_feed_task(). As a consequence, the feed queries in question go from explicitly "re-compute unconditionally" to effectively "re-use unconditionally" 😅

The reason seems to be that we set task_deps_ref to TaskDepsRef::Ignore for eval_always queries. That's fine for those queries themselves because we make sure to re-compute those explicitly. But we fail to "inherit" the eval-always-ness to nested feed-queries.

I'll look into fixing this some time this week.

@michaelwoerister michaelwoerister self-assigned this Apr 3, 2023
@bors bors closed this as completed in 661b33f Apr 12, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this issue Apr 14, 2023
…jgillot

incr.comp.: Make sure dependencies are recorded when feeding queries during eval-always queries.

This PR makes sure we don't drop dependency edges when feeding queries during an eval-always query.

Background: During eval-always queries, no dependencies are recorded because the system knows to unconditionally re-evaluate them regardless of any actual dependencies. This works fine for these queries themselves but leads to a problem when feeding other queries: When queries are fed, we set up their dependency edges by copying the current set of dependencies of the feeding query. But because this set is empty for eval-always queries, we record no edges at all -- which has the effect that the fed query instances always look "green" to the system, although they should always be "red".

The fix is to explicitly add a dependency on the artificial "always red" dep-node when feeding during eval-always queries.

Fixes rust-lang/rust#108481
Maybe also fixes issue rust-lang/rust#88488.

cc `@jyn514`

r? `@cjgillot` or `@oli-obk`
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) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
4 participants