Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error encountered when attempting to get the size of a string created from [21u8; u32::MAX as usize] #111613

Closed
chanced opened this issue May 15, 2023 · 2 comments · Fixed by #113562
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

@chanced
Copy link

chanced commented May 15, 2023

Code

fn main() {
    let string = String::from_utf8_lossy(&[21u8; u32::MAX as usize]).to_string();
    println!("{}", std::mem::size_of_val(string.as_str()));
}

Meta

rustc --version --verbose:

rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: aarch64-apple-darwin
release: 1.69.0
LLVM version: 15.0.7

Error output

thread 'rustc' panicked at 'invalid enum variant tag while decoding `AllocDiscriminant`, expected 0..4', /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/compiler/rustc_middle/src/mir/interpret/mod.rs:195:10
stack backtrace:
   0:        0x104b68468 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h105074e3d85f800b
   1:        0x104bbb388 - core::fmt::write::h34766cf8fff7af1e
   2:        0x104b5e1e0 - std::io::Write::write_fmt::hd64c4cf6e7adea59
   3:        0x104b6827c - std::sys_common::backtrace::print::h2a6828a537036cf9
   4:        0x104b6ad04 - std::panicking::default_hook::{{closure}}::h4e82ce6ccef941b2
   5:        0x104b6aa5c - std::panicking::default_hook::h29f62f8795c5cb00
   6:        0x10cc3d74c - rustc_driver_impl[4da67b3d18d5a97a]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x104b6b3fc - std::panicking::rust_panic_with_hook::h19862cbd0fbda7ba
   8:        0x104b6b1b4 - std::panicking::begin_panic_handler::{{closure}}::h3f3626935e1669fe
   9:        0x104b68888 - std::sys_common::backtrace::__rust_end_short_backtrace::h5054ef52bd507d0a
  10:        0x104b6af50 - _rust_begin_unwind
  11:        0x104be6608 - core::panicking::panic_fmt::h7e47e10600a90221
  12:        0x10fd81cb0 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::AllocDiscriminant as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  13:        0x10fd62ad0 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::AllocDecodingSession>::decode_alloc_id::<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>
  14:        0x10fe3c1b0 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::pointer::Pointer as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  15:        0x10feb4d9c - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  16:        0x10fd5e698 - <core[446d629763b4aa]::result::Result<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue, rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::error::ErrorHandled> as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  17:        0x10fdd147c - <rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::OnDiskCache>::try_load_query_result::<core[446d629763b4aa]::result::Result<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue, rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::error::ErrorHandled>>
  18:        0x10fcf65f0 - <<rustc_query_impl[4d60d89ac47f5f83]::queries::eval_to_const_value_raw as rustc_query_system[4ec8b7e6ed7d2b80]::query::config::QueryConfig<rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>>::try_load_from_disk::{closure#0} as core[446d629763b4aa]::ops::function::FnOnce<(rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt, rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::serialized::SerializedDepNodeIndex)>>::call_once
  19:        0x10fd7ad3c - <rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind as rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::DepKind>::with_deps::<rustc_query_system[4ec8b7e6ed7d2b80]::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl[4d60d89ac47f5f83]::queries::eval_to_const_value_raw, rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>::{closure#0}, core[446d629763b4aa]::option::Option<core[446d629763b4aa]::result::Result<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue, rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::error::ErrorHandled>>>
  20:        0x10fc8b95c - rustc_query_system[4ec8b7e6ed7d2b80]::query::plumbing::try_execute_query::<rustc_query_impl[4d60d89ac47f5f83]::queries::eval_to_const_value_raw, rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>
  21:        0x10fd99d68 - <rustc_query_impl[4d60d89ac47f5f83]::Queries as rustc_middle[a12d4e31e9c7c7b2]::ty::query::QueryEngine>::eval_to_const_value_raw
  22:        0x110886d78 - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::TyCtxt>::const_eval_global_id
  23:        0x11088673c - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::TyCtxt>::const_eval_resolve
  24:        0x10f1b7494 - <rustc_monomorphize[ba23129770f20443]::collector::MirNeighborCollector as rustc_middle[a12d4e31e9c7c7b2]::mir::visit::Visitor>::visit_constant
  25:        0x10f1b3f80 - <rustc_monomorphize[ba23129770f20443]::collector::MirNeighborCollector as rustc_middle[a12d4e31e9c7c7b2]::mir::visit::Visitor>::visit_operand
  26:        0x10f1b2ee0 - <rustc_monomorphize[ba23129770f20443]::collector::MirNeighborCollector as rustc_middle[a12d4e31e9c7c7b2]::mir::visit::Visitor>::visit_rvalue
  27:        0x10f1b7fa8 - rustc_monomorphize[ba23129770f20443]::collector::collect_neighbours
  28:        0x10f1b6a08 - rustc_monomorphize[ba23129770f20443]::collector::collect_items_rec
  29:        0x10f1b6e08 - rustc_monomorphize[ba23129770f20443]::collector::collect_items_rec
  30:        0x10f1af7a8 - <core[446d629763b4aa]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[a49ab2b4a1c20397]::sync::par_for_each_in<alloc[f251364f33aae5a4]::vec::Vec<rustc_middle[a12d4e31e9c7c7b2]::mir::mono::MonoItem>, rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> as core[446d629763b4aa]::ops::function::FnOnce<()>>::call_once
  31:        0x10f1a9398 - rustc_data_structures[a49ab2b4a1c20397]::sync::par_for_each_in::<alloc[f251364f33aae5a4]::vec::Vec<rustc_middle[a12d4e31e9c7c7b2]::mir::mono::MonoItem>, rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  32:        0x10f1acb68 - <rustc_session[f1d766c083bcad2f]::session::Session>::time::<(), rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items::{closure#1}>
  33:        0x10f1b513c - rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items
  34:        0x10f1be608 - rustc_monomorphize[ba23129770f20443]::partitioning::collect_and_partition_mono_items
  35:        0x10fd70a60 - <rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind as rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::DepKind>::with_deps::<<rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::graph::DepGraph<rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt, (), (&rustc_data_structures[a49ab2b4a1c20397]::unord::UnordSet<rustc_span[9bec1e8d1a20d9df]::def_id::DefId>, &[rustc_middle[a12d4e31e9c7c7b2]::mir::mono::CodegenUnit])>::{closure#0}, (&rustc_data_structures[a49ab2b4a1c20397]::unord::UnordSet<rustc_span[9bec1e8d1a20d9df]::def_id::DefId>, &[rustc_middle[a12d4e31e9c7c7b2]::mir::mono::CodegenUnit])>
  36:        0x10fcc6d5c - rustc_query_system[4ec8b7e6ed7d2b80]::query::plumbing::try_execute_query::<rustc_query_impl[4d60d89ac47f5f83]::queries::collect_and_partition_mono_items, rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>
  37:        0x10fda6920 - <rustc_query_impl[4d60d89ac47f5f83]::Queries as rustc_middle[a12d4e31e9c7c7b2]::ty::query::QueryEngine>::collect_and_partition_mono_items
  38:        0x10cdc55b0 - rustc_codegen_ssa[6f96b87013603e7f]::base::codegen_crate::<rustc_codegen_llvm[96a2ad4a628786a9]::LlvmCodegenBackend>
  39:        0x10cdad650 - <rustc_codegen_llvm[96a2ad4a628786a9]::LlvmCodegenBackend as rustc_codegen_ssa[6f96b87013603e7f]::traits::backend::CodegenBackend>::codegen_crate
  40:        0x10cce1824 - <rustc_session[f1d766c083bcad2f]::session::Session>::time::<alloc[f251364f33aae5a4]::boxed::Box<dyn core[446d629763b4aa]::any::Any>, rustc_interface[812bb1defcb7896d]::passes::start_codegen::{closure#0}>
  41:        0x10ccda960 - rustc_interface[812bb1defcb7896d]::passes::start_codegen
  42:        0x10ccdc6c4 - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::GlobalCtxt>::enter::<<rustc_interface[812bb1defcb7896d]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[446d629763b4aa]::result::Result<alloc[f251364f33aae5a4]::boxed::Box<dyn core[446d629763b4aa]::any::Any>, rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>
  43:        0x10cd01a58 - <rustc_interface[812bb1defcb7896d]::queries::Queries>::ongoing_codegen
  44:        0x10cc89b70 - rustc_span[9bec1e8d1a20d9df]::with_source_map::<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_interface[812bb1defcb7896d]::interface::run_compiler<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_driver_impl[4da67b3d18d5a97a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  45:        0x10cc4bf84 - std[57ecbc5b2c1792f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[812bb1defcb7896d]::util::run_in_thread_pool_with_globals<rustc_interface[812bb1defcb7896d]::interface::run_compiler<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_driver_impl[4da67b3d18d5a97a]::run_compiler::{closure#1}>::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>
  46:        0x10cc4dd20 - <<std[57ecbc5b2c1792f]::thread::Builder>::spawn_unchecked_<rustc_interface[812bb1defcb7896d]::util::run_in_thread_pool_with_globals<rustc_interface[812bb1defcb7896d]::interface::run_compiler<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_driver_impl[4da67b3d18d5a97a]::run_compiler::{closure#1}>::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>::{closure#1} as core[446d629763b4aa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:        0x104b73a24 - std::sys::unix::thread::Thread::new::thread_start::h5db5d66cd91ffb33
  48:        0x1b214606c - __pthread_deallocate

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.69.0 (84c898d65 2023-04-16) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -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: 53', /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/compiler/rustc_query_system/src/dep_graph/graph.rs:450:25
stack backtrace:
   0:        0x104b68468 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h105074e3d85f800b
   1:        0x104bbb388 - core::fmt::write::h34766cf8fff7af1e
   2:        0x104b5e1e0 - std::io::Write::write_fmt::hd64c4cf6e7adea59
   3:        0x104b6827c - std::sys_common::backtrace::print::h2a6828a537036cf9
   4:        0x104b6ad04 - std::panicking::default_hook::{{closure}}::h4e82ce6ccef941b2
   5:        0x104b6aa5c - std::panicking::default_hook::h29f62f8795c5cb00
   6:        0x10cc3d74c - rustc_driver_impl[4da67b3d18d5a97a]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x104b6b3fc - std::panicking::rust_panic_with_hook::h19862cbd0fbda7ba
   8:        0x104b6b1f4 - std::panicking::begin_panic_handler::{{closure}}::h3f3626935e1669fe
   9:        0x104b68888 - std::sys_common::backtrace::__rust_end_short_backtrace::h5054ef52bd507d0a
  10:        0x104b6af50 - _rust_begin_unwind
  11:        0x104be6608 - core::panicking::panic_fmt::h7e47e10600a90221
  12:        0x1108e2090 - <rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind as rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::DepKind>::read_deps::<<rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::graph::DepGraph<rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind>>::read_index::{closure#0}>
  13:        0x11087e07c - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::TyCtxt>::type_length_limit
  14:        0x110872050 - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::TyCtxt>::def_path_str
  15:        0x1109d7d84 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::GlobalId>::display
  16:        0x1109677d8 - rustc_middle[a12d4e31e9c7c7b2]::query::descs::eval_to_const_value_raw
  17:        0x10fe0c440 - rustc_query_impl[4d60d89ac47f5f83]::plumbing::create_query_frame::<rustc_middle[a12d4e31e9c7c7b2]::ty::ParamEnvAnd<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::GlobalId>>
  18:        0x10fed5c4c - <rustc_query_impl[4d60d89ac47f5f83]::query_structs::eval_to_const_value_raw::{closure#0} as core[446d629763b4aa]::ops::function::FnOnce<(rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt, &mut std[57ecbc5b2c1792f]::collections::hash::map::HashMap<rustc_query_system[4ec8b7e6ed7d2b80]::query::job::QueryJobId, rustc_query_system[4ec8b7e6ed7d2b80]::query::job::QueryJobInfo<rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind>, core[446d629763b4aa]::hash::BuildHasherDefault<rustc_hash[3c71cadb9a051031]::FxHasher>>)>>::call_once
  19:        0x10fe2b8a0 - rustc_query_system[4ec8b7e6ed7d2b80]::query::job::print_query_stack::<rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>
  20:        0x10ccebf48 - rustc_interface[812bb1defcb7896d]::interface::try_print_query_stack
  21:        0x10cc3e024 - rustc_driver_impl[4da67b3d18d5a97a]::report_ice
  22:        0x10cc3d788 - rustc_driver_impl[4da67b3d18d5a97a]::DEFAULT_HOOK::{closure#0}::{closure#0}
  23:        0x104b6b3fc - std::panicking::rust_panic_with_hook::h19862cbd0fbda7ba
  24:        0x104b6b1b4 - std::panicking::begin_panic_handler::{{closure}}::h3f3626935e1669fe
  25:        0x104b68888 - std::sys_common::backtrace::__rust_end_short_backtrace::h5054ef52bd507d0a
  26:        0x104b6af50 - _rust_begin_unwind
  27:        0x104be6608 - core::panicking::panic_fmt::h7e47e10600a90221
  28:        0x10fd81cb0 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::AllocDiscriminant as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  29:        0x10fd62ad0 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::AllocDecodingSession>::decode_alloc_id::<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>
  30:        0x10fe3c1b0 - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::pointer::Pointer as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  31:        0x10feb4d9c - <rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  32:        0x10fd5e698 - <core[446d629763b4aa]::result::Result<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue, rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::error::ErrorHandled> as rustc_serialize[75a1f45f8c95edce]::serialize::Decodable<rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::CacheDecoder>>::decode
  33:        0x10fdd147c - <rustc_query_impl[4d60d89ac47f5f83]::on_disk_cache::OnDiskCache>::try_load_query_result::<core[446d629763b4aa]::result::Result<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue, rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::error::ErrorHandled>>
  34:        0x10fcf65f0 - <<rustc_query_impl[4d60d89ac47f5f83]::queries::eval_to_const_value_raw as rustc_query_system[4ec8b7e6ed7d2b80]::query::config::QueryConfig<rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>>::try_load_from_disk::{closure#0} as core[446d629763b4aa]::ops::function::FnOnce<(rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt, rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::serialized::SerializedDepNodeIndex)>>::call_once
  35:        0x10fd7ad3c - <rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind as rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::DepKind>::with_deps::<rustc_query_system[4ec8b7e6ed7d2b80]::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl[4d60d89ac47f5f83]::queries::eval_to_const_value_raw, rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>::{closure#0}, core[446d629763b4aa]::option::Option<core[446d629763b4aa]::result::Result<rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::value::ConstValue, rustc_middle[a12d4e31e9c7c7b2]::mir::interpret::error::ErrorHandled>>>
  36:        0x10fc8b95c - rustc_query_system[4ec8b7e6ed7d2b80]::query::plumbing::try_execute_query::<rustc_query_impl[4d60d89ac47f5f83]::queries::eval_to_const_value_raw, rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>
  37:        0x10fd99d68 - <rustc_query_impl[4d60d89ac47f5f83]::Queries as rustc_middle[a12d4e31e9c7c7b2]::ty::query::QueryEngine>::eval_to_const_value_raw
  38:        0x110886d78 - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::TyCtxt>::const_eval_global_id
  39:        0x11088673c - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::TyCtxt>::const_eval_resolve
  40:        0x10f1b7494 - <rustc_monomorphize[ba23129770f20443]::collector::MirNeighborCollector as rustc_middle[a12d4e31e9c7c7b2]::mir::visit::Visitor>::visit_constant
  41:        0x10f1b3f80 - <rustc_monomorphize[ba23129770f20443]::collector::MirNeighborCollector as rustc_middle[a12d4e31e9c7c7b2]::mir::visit::Visitor>::visit_operand
  42:        0x10f1b2ee0 - <rustc_monomorphize[ba23129770f20443]::collector::MirNeighborCollector as rustc_middle[a12d4e31e9c7c7b2]::mir::visit::Visitor>::visit_rvalue
  43:        0x10f1b7fa8 - rustc_monomorphize[ba23129770f20443]::collector::collect_neighbours
  44:        0x10f1b6a08 - rustc_monomorphize[ba23129770f20443]::collector::collect_items_rec
  45:        0x10f1b6e08 - rustc_monomorphize[ba23129770f20443]::collector::collect_items_rec
  46:        0x10f1af7a8 - <core[446d629763b4aa]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[a49ab2b4a1c20397]::sync::par_for_each_in<alloc[f251364f33aae5a4]::vec::Vec<rustc_middle[a12d4e31e9c7c7b2]::mir::mono::MonoItem>, rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> as core[446d629763b4aa]::ops::function::FnOnce<()>>::call_once
  47:        0x10f1a9398 - rustc_data_structures[a49ab2b4a1c20397]::sync::par_for_each_in::<alloc[f251364f33aae5a4]::vec::Vec<rustc_middle[a12d4e31e9c7c7b2]::mir::mono::MonoItem>, rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  48:        0x10f1acb68 - <rustc_session[f1d766c083bcad2f]::session::Session>::time::<(), rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items::{closure#1}>
  49:        0x10f1b513c - rustc_monomorphize[ba23129770f20443]::collector::collect_crate_mono_items
  50:        0x10f1be608 - rustc_monomorphize[ba23129770f20443]::partitioning::collect_and_partition_mono_items
  51:        0x10fd70a60 - <rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind as rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::DepKind>::with_deps::<<rustc_query_system[4ec8b7e6ed7d2b80]::dep_graph::graph::DepGraph<rustc_middle[a12d4e31e9c7c7b2]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt, (), (&rustc_data_structures[a49ab2b4a1c20397]::unord::UnordSet<rustc_span[9bec1e8d1a20d9df]::def_id::DefId>, &[rustc_middle[a12d4e31e9c7c7b2]::mir::mono::CodegenUnit])>::{closure#0}, (&rustc_data_structures[a49ab2b4a1c20397]::unord::UnordSet<rustc_span[9bec1e8d1a20d9df]::def_id::DefId>, &[rustc_middle[a12d4e31e9c7c7b2]::mir::mono::CodegenUnit])>
  52:        0x10fcc6d5c - rustc_query_system[4ec8b7e6ed7d2b80]::query::plumbing::try_execute_query::<rustc_query_impl[4d60d89ac47f5f83]::queries::collect_and_partition_mono_items, rustc_query_impl[4d60d89ac47f5f83]::plumbing::QueryCtxt>
  53:        0x10fda6920 - <rustc_query_impl[4d60d89ac47f5f83]::Queries as rustc_middle[a12d4e31e9c7c7b2]::ty::query::QueryEngine>::collect_and_partition_mono_items
  54:        0x10cdc55b0 - rustc_codegen_ssa[6f96b87013603e7f]::base::codegen_crate::<rustc_codegen_llvm[96a2ad4a628786a9]::LlvmCodegenBackend>
  55:        0x10cdad650 - <rustc_codegen_llvm[96a2ad4a628786a9]::LlvmCodegenBackend as rustc_codegen_ssa[6f96b87013603e7f]::traits::backend::CodegenBackend>::codegen_crate
  56:        0x10cce1824 - <rustc_session[f1d766c083bcad2f]::session::Session>::time::<alloc[f251364f33aae5a4]::boxed::Box<dyn core[446d629763b4aa]::any::Any>, rustc_interface[812bb1defcb7896d]::passes::start_codegen::{closure#0}>
  57:        0x10ccda960 - rustc_interface[812bb1defcb7896d]::passes::start_codegen
  58:        0x10ccdc6c4 - <rustc_middle[a12d4e31e9c7c7b2]::ty::context::GlobalCtxt>::enter::<<rustc_interface[812bb1defcb7896d]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[446d629763b4aa]::result::Result<alloc[f251364f33aae5a4]::boxed::Box<dyn core[446d629763b4aa]::any::Any>, rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>
  59:        0x10cd01a58 - <rustc_interface[812bb1defcb7896d]::queries::Queries>::ongoing_codegen
  60:        0x10cc89b70 - rustc_span[9bec1e8d1a20d9df]::with_source_map::<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_interface[812bb1defcb7896d]::interface::run_compiler<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_driver_impl[4da67b3d18d5a97a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  61:        0x10cc4bf84 - std[57ecbc5b2c1792f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[812bb1defcb7896d]::util::run_in_thread_pool_with_globals<rustc_interface[812bb1defcb7896d]::interface::run_compiler<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_driver_impl[4da67b3d18d5a97a]::run_compiler::{closure#1}>::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>
  62:        0x10cc4dd20 - <<std[57ecbc5b2c1792f]::thread::Builder>::spawn_unchecked_<rustc_interface[812bb1defcb7896d]::util::run_in_thread_pool_with_globals<rustc_interface[812bb1defcb7896d]::interface::run_compiler<core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>, rustc_driver_impl[4da67b3d18d5a97a]::run_compiler::{closure#1}>::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446d629763b4aa]::result::Result<(), rustc_span[9bec1e8d1a20d9df]::ErrorGuaranteed>>::{closure#1} as core[446d629763b4aa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  63:        0x104b73a24 - std::sys::unix::thread::Thread::new::thread_start::h5db5d66cd91ffb33
  64:        0x1b214606c - __pthread_deallocate

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.69.0 (84c898d65 2023-04-16) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -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:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `rust-playground`

Caused by:
  process didn't exit successfully: `rustc --crate-name rust_playground --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=436 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=7791f0de757a0be7 -C extra-filename=-7791f0de757a0be7 --out-dir /Users/chance/dev/spike/rust/playground/target/debug/deps -C incremental=/Users/chance/dev/spike/rust/playground/target/debug/incremental -L dependency=/Users/chance/dev/spike/rust/playground/target/debug/deps` (signal: 6, SIGABRT: process abort signal)


Backtrace

thread 'rustc' panicked at 'invalid enum variant tag while decoding `AllocDiscriminant`, expected 0..4', /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/compiler/rustc_middle/src/mir/interpret/mod.rs:195:10
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_middle::mir::interpret::AllocDiscriminant as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   3: <rustc_middle::mir::interpret::AllocDecodingSession>::decode_alloc_id::<rustc_query_impl::on_disk_cache::CacheDecoder>
   4: <rustc_middle::mir::interpret::pointer::Pointer as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   5: <rustc_middle::mir::interpret::value::ConstValue as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   6: <core::result::Result<rustc_middle::mir::interpret::value::ConstValue, rustc_middle::mir::interpret::error::ErrorHandled> as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
   7: <rustc_query_impl::on_disk_cache::OnDiskCache>::try_load_query_result::<core::result::Result<rustc_middle::mir::interpret::value::ConstValue, rustc_middle::mir::interpret::error::ErrorHandled>>
   8: <<rustc_query_impl::queries::eval_to_const_value_raw as rustc_query_system::query::config::QueryConfig<rustc_query_impl::plumbing::QueryCtxt>>::try_load_from_disk::{closure#0} as core::ops::function::FnOnce<(rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::dep_graph::serialized::SerializedDepNodeIndex)>>::call_once
   9: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl::queries::eval_to_const_value_raw, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, core::option::Option<core::result::Result<rustc_middle::mir::interpret::value::ConstValue, rustc_middle::mir::interpret::error::ErrorHandled>>>
  10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_const_value_raw, rustc_query_impl::plumbing::QueryCtxt>
  11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  12: <rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  13: <rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  14: <rustc_monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_constant
  15: <rustc_monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_operand
  16: <rustc_monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_rvalue
  17: rustc_monomorphize::collector::collect_neighbours
  18: rustc_monomorphize::collector::collect_items_rec
  19: <core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::par_for_each_in<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> as core::ops::function::FnOnce<()>>::call_once
  20: rustc_data_structures::sync::par_for_each_in::<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  21: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
  22: rustc_monomorphize::collector::collect_crate_mono_items
  23: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  24: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_query_impl::plumbing::QueryCtxt, (), (&rustc_data_structures::unord::UnordSet<rustc_span::def_id::DefId>, &[rustc_middle::mir::mono::CodegenUnit])>::{closure#0}, (&rustc_data_structures::unord::UnordSet<rustc_span::def_id::DefId>, &[rustc_middle::mir::mono::CodegenUnit])>
  25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::collect_and_partition_mono_items, rustc_query_impl::plumbing::QueryCtxt>
  26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
  27: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  28: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  29: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  30: rustc_interface::passes::start_codegen
  31: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
  32: <rustc_interface::queries::Queries>::ongoing_codegen
  33: rustc_span::with_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@chanced chanced 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 May 15, 2023
@matthiaskrgr
Copy link
Member

Hm, when using incr comp. on 1.71, I get

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())', compiler/rustc_middle/src/query/on_disk_cache.rs:304:70
stack backtrace:
   0:     0x7f535b7f06e1 - std::backtrace_rs::backtrace::libunwind::trace::h4354896f1663baaf
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f535b7f06e1 - std::backtrace_rs::backtrace::trace_unsynchronized::h8ac49f89c23585dd
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f535b7f06e1 - std::sys_common::backtrace::_print_fmt::h9f5f16b3ef080000
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f535b7f06e1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcfed927151d1ad83
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f535b850bdf - core::fmt::rt::Argument::fmt::h12fb43eea2fe23a8
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/core/src/fmt/rt.rs:138:9
   5:     0x7f535b850bdf - core::fmt::write::hcf94a34baaaea06f
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f535b7e3941 - std::io::Write::write_fmt::h60003491edc2e074
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/io/mod.rs:1712:15
   7:     0x7f535b7f04f5 - std::sys_common::backtrace::_print::h9a8311322b9d8667
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f535b7f04f5 - std::sys_common::backtrace::print::h8503eaeeae92ea08
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f535b7f3177 - std::panicking::default_hook::{{closure}}::h36a123b73b99c0f3
  10:     0x7f535b7f2f64 - std::panicking::default_hook::ha2efb9fc5f628e61
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/panicking.rs:288:9
  11:     0x7f535a6c87db - rustc_driver_impl[64b7dd1911194932]::install_ice_hook::{closure#0}
  12:     0x7f535b7f3897 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h250e911c4e8d011a
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/alloc/src/boxed.rs:1999:9
  13:     0x7f535b7f3897 - std::panicking::rust_panic_with_hook::h5d9e02f555bc48d2
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/panicking.rs:695:13
  14:     0x7f535b7f3617 - std::panicking::begin_panic_handler::{{closure}}::hbb00bd8fdd3417d9
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/panicking.rs:582:13
  15:     0x7f535b7f0b26 - std::sys_common::backtrace::__rust_end_short_backtrace::ha9ceea58b8cf1deb
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/sys_common/backtrace.rs:150:18
  16:     0x7f535b7f3382 - rust_begin_unwind
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/panicking.rs:578:5
  17:     0x7f535b84ce63 - core::panicking::panic_fmt::h1df8faa11491e0c5
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/core/src/panicking.rs:67:14
  18:     0x7f535b84d483 - core::result::unwrap_failed::h4175d949b4f9e8b9
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/core/src/result.rs:1651:5
  19:     0x7f5359cbfb1f - rustc_middle[f607de435e9a4418]::ty::context::tls::with_context::<<rustc_middle[f607de435e9a4418]::dep_graph::dep_node::DepKind as rustc_query_system[7835b3e98a87b812]::dep_graph::DepKind>::with_deps<<rustc_middle[f607de435e9a4418]::query::on_disk_cache::OnDiskCache>::serialize::{closure#0}, core[b4a8d54be4c63c12]::result::Result<usize, std[d9d2839bce1dd559]::io::error::Error>>::{closure#0}, core[b4a8d54be4c63c12]::result::Result<usize, std[d9d2839bce1dd559]::io::error::Error>>::{closure#0}
  20:     0x7f5359c8b521 - <rustc_middle[f607de435e9a4418]::ty::context::TyCtxt>::serialize_query_result_cache
  21:     0x7f5359c8b117 - <rustc_session[22fc273b1747149c]::session::Session>::time::<core[b4a8d54be4c63c12]::result::Result<usize, std[d9d2839bce1dd559]::io::error::Error>, rustc_incremental[ce295fd98e3725ed]::persist::save::encode_query_cache::{closure#0}>
  22:     0x7f5359c8a1ec - rustc_incremental[ce295fd98e3725ed]::persist::file_format::save_in::<rustc_incremental[ce295fd98e3725ed]::persist::save::save_dep_graph::{closure#0}::{closure#2}::{closure#0}::{closure#0}>
  23:     0x7f5359c89602 - <rustc_session[22fc273b1747149c]::session::Session>::time::<(), rustc_incremental[ce295fd98e3725ed]::persist::save::save_dep_graph::{closure#0}::{closure#2}::{closure#0}>
  24:     0x7f5359c6986f - rustc_data_structures[d67636fd6e7e7cea]::sync::join::<rustc_incremental[ce295fd98e3725ed]::persist::save::save_dep_graph::{closure#0}::{closure#2}, rustc_incremental[ce295fd98e3725ed]::persist::save::save_dep_graph::{closure#0}::{closure#3}, (), ()>
  25:     0x7f5359c633b6 - rustc_incremental[ce295fd98e3725ed]::persist::save::save_dep_graph
  26:     0x7f5359c63087 - <rustc_session[22fc273b1747149c]::session::Session>::time::<(), <rustc_interface[d75252421fea963]::interface::Compiler>::enter<rustc_driver_impl[64b7dd1911194932]::run_compiler::{closure#1}::{closure#2}, core[b4a8d54be4c63c12]::result::Result<core[b4a8d54be4c63c12]::option::Option<rustc_interface[d75252421fea963]::queries::Linker>, rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>::{closure#0}>
  27:     0x7f5359c60119 - <rustc_interface[d75252421fea963]::interface::Compiler>::enter::<rustc_driver_impl[64b7dd1911194932]::run_compiler::{closure#1}::{closure#2}, core[b4a8d54be4c63c12]::result::Result<core[b4a8d54be4c63c12]::option::Option<rustc_interface[d75252421fea963]::queries::Linker>, rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>
  28:     0x7f5359c5dcfd - <scoped_tls[36ad800287692b7a]::ScopedKey<rustc_span[f3562a9d228bc34b]::SessionGlobals>>::set::<rustc_interface[d75252421fea963]::interface::run_compiler<core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>, rustc_driver_impl[64b7dd1911194932]::run_compiler::{closure#1}>::{closure#0}, core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>
  29:     0x7f5359c5d156 - std[d9d2839bce1dd559]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d75252421fea963]::util::run_in_thread_pool_with_globals<rustc_interface[d75252421fea963]::interface::run_compiler<core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>, rustc_driver_impl[64b7dd1911194932]::run_compiler::{closure#1}>::{closure#0}, core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>
  30:     0x7f5359c5cf05 - <<std[d9d2839bce1dd559]::thread::Builder>::spawn_unchecked_<rustc_interface[d75252421fea963]::util::run_in_thread_pool_with_globals<rustc_interface[d75252421fea963]::interface::run_compiler<core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>, rustc_driver_impl[64b7dd1911194932]::run_compiler::{closure#1}>::{closure#0}, core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a8d54be4c63c12]::result::Result<(), rustc_span[f3562a9d228bc34b]::ErrorGuaranteed>>::{closure#1} as core[b4a8d54be4c63c12]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f535b7fdd45 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0ee7a0a44efbcb8b
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/alloc/src/boxed.rs:1985:9
  32:     0x7f535b7fdd45 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8f984f8b1c075279
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/alloc/src/boxed.rs:1985:9
  33:     0x7f535b7fdd45 - std::sys::unix::thread::Thread::new::thread_start::h054937194df87b6d
                               at /rustc/18bfe5d8a9ca0e226171e98f8f4ef071790f3352/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7f5357465bb5 - <unknown>
  35:     0x7f53574e7d90 - <unknown>
  36:                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.71.0-nightly (18bfe5d8a 2023-05-14) running on x86_64-unknown-linux-gnu

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

query stack during panic:
end of query stack
[1]    555227 killed     rustc bad.rs --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked

but if I skip incr comp, I only get a linker error:

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/matthias/.cargo/bin:/home/matthias/bin:/usr/local/bin:/home/matthias/.cargo/bin:/home/matthias/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/home/matthias/.dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcJEKTvj/symbols.o" "bad.bad.58b4c2d36dba6e75-cgu.0.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.1.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.10.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.11.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.12.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.13.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.2.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.3.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.4.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.5.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.6.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.7.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.8.rcgu.o" "bad.bad.58b4c2d36dba6e75-cgu.9.rcgu.o" "bad.1dx5asfctbwkgcc0.rcgu.o" "-Wl,--as-needed" "-L" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edb03adabf0b22c8.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-56c2a42cc2d7381f.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-fd705a60736c3357.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-c0ff7ddb2987d8da.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-c459f8b0a64f04e1.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-c2d64f918d4b26ad.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-d22c51811a78dc80.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-d8ba7f24f3cb57da.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-2a372fbb5b41c14b.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-45ff23c614a38f1d.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-6b9410c3805b4c08.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-6deb8c633abe47e3.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-57df4eca7d5785df.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-0b7d1529f62927c0.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-69a45ab5967387b5.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c2c050aec00eb6da.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-522518611024dce5.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-35b8a4bd2de4e62e.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "bad" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: ld: error: bad:(.eh_frame+0x5029): relocation R_X86_64_PC32 out of range: -4295022257 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5051): relocation R_X86_64_PC32 out of range: -4295022281 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5079): relocation R_X86_64_PC32 out of range: -4295022305 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5099): relocation R_X86_64_PC32 out of range: -4295022325 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x50c1): relocation R_X86_64_PC32 out of range: -4295022341 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x50e1): relocation R_X86_64_PC32 out of range: -4295022289 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5119): relocation R_X86_64_PC32 out of range: -4295022285 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5151): relocation R_X86_64_PC32 out of range: -4295022293 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5189): relocation R_X86_64_PC32 out of range: -4295022337 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x51c9): relocation R_X86_64_PC32 out of range: -4295022369 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5209): relocation R_X86_64_PC32 out of range: -4295022397 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5249): relocation R_X86_64_PC32 out of range: -4295022421 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5279): relocation R_X86_64_PC32 out of range: -4295022457 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x52d1): relocation R_X86_64_PC32 out of range: -4295022517 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5311): relocation R_X86_64_PC32 out of range: -4295022553 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5351): relocation R_X86_64_PC32 out of range: -4295022605 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5391): relocation R_X86_64_PC32 out of range: -4295022645 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x53d1): relocation R_X86_64_PC32 out of range: -4295022673 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5429): relocation R_X86_64_PC32 out of range: -4295022705 is not in [-2147483648, 2147483647]
          ld: error: bad:(.eh_frame+0x5469): relocation R_X86_64_PC32 out of range: -4295022745 is not in [-2147483648, 2147483647]
          ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

@saethlin
Copy link
Member

The ICE that you have @matthiaskrgr is working as intended: #110632

The on-disk cache uses 32-bit offsets. So do linkers. This isn't good but it's more of a design flaw than a bug.

@bors bors closed this as completed in 6f65ef5 Jul 17, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jul 18, 2023
Use u64 for incr comp allocation offsets

Fixes rust-lang/rust#76037
Fixes rust-lang/rust#95780
Fixes rust-lang/rust#111613

These issues are all reporting ICEs caused by using `u32` to store offsets to allocations in the incremental compilation cache. This PR aims to lift that limitation by changing the offset type in question to `u64`.

There are two perf runs in this PR. The first reports a regression, and the second does not. The changes are the same in both. I rebased the PR then did the second perf run because I noticed that the primary regression in it was very commonly seen in spurious regression reports.

I do not know what the perf run will report when this is merged. I would not be surprised to see regression or neutral, but the cachegrind diffs for the regression point at `try_mark_previous_green` which is a common source of inexplicable regressions and I don't think should be perturbed by this PR.

I'm not opposed to adding a regression test such as
```rust
fn main() {
    println!("{}", [37; 1 << 30].len());
}
```
But that program takes 1 minute to compile and consumes 4.6 GB of memory then writes that much to disk. Is that a concerning amount of resource use for a test?

r? `@nnethercote`
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

Successfully merging a pull request may close this issue.

3 participants