Skip to content

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

Closed
@chanced

Description

@chanced

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions