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 when compiling #127547

Closed
scouten opened this issue Jul 10, 2024 · 2 comments
Closed

ICE when compiling #127547

scouten opened this issue Jul 10, 2024 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@scouten
Copy link

scouten commented Jul 10, 2024

Code

The code is in this (public) branch: https://github.com/scouten/asciidoc-parser/tree/rustc-ice-127547.

A snapshot of the code when the ICE first appeared is in commit 69c1795. I'll make a brief attempt to narrow the repro case; if I can create a narrower repro case, I'll push that to that branch.

Meta

at 18:52:47 ❯ rustc --version --verbose
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: aarch64-apple-darwin
release: 1.79.0
LLVM version: 18.1.7

Error output

error: internal compiler error: compiler/rustc_const_eval/src/interpret/eval_context.rs:1184:21: interpret const eval failure of Unevaluated(UnevaluatedConst { def: DefId(0:99 ~ asciidoc_parser[e016]::blocks::is_block::IsBlock::nested_blocks::NO_BLOCKS), args: [], promoted: Some(promoted[0]) }, &'{erased} [blocks::block::Block<'{erased}>; 0_usize]) which is not in required_consts

thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/eval_context.rs:1184:21:
Box<dyn Any>
stack backtrace:
   0:        0x101c89750 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1f3776e0b5c7517d
   1:        0x101ccc470 - core::fmt::write::heedef092c8c0962e
   2:        0x101c7fa1c - std::io::Write::write_fmt::h7178e8e2ea928914
   3:        0x101c895a8 - std::sys_common::backtrace::print::h417292deb95532ed
   4:        0x101c8bb2c - std::panicking::default_hook::{{closure}}::h0cb68f1228c4613a
   5:        0x101c8b820 - std::panicking::default_hook::h24535936bc1f51de
   6:        0x10b157828 - <alloc[d07bc629de031c28]::boxed::Box<rustc_driver_impl[17630cf877ef70bb]::install_ice_hook::{closure#0}> as core[fca7800875c611c6]::ops::function::Fn<(&dyn for<'a, 'b> core[fca7800875c611c6]::ops::function::Fn<(&'a core[fca7800875c611c6]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[fca7800875c611c6]::marker::Sync + core[fca7800875c611c6]::marker::Send, &core[fca7800875c611c6]::panic::panic_info::PanicInfo)>>::call
   7:        0x101c8c524 - std::panicking::rust_panic_with_hook::h5db4d2345b297bed
   8:        0x10b1e3198 - std[e84bc52996b8b382]::panicking::begin_panic::<rustc_errors[3520987c35dd2513]::ExplicitBug>::{closure#0}
   9:        0x10b1e1ce0 - std[e84bc52996b8b382]::sys_common::backtrace::__rust_end_short_backtrace::<std[e84bc52996b8b382]::panicking::begin_panic<rustc_errors[3520987c35dd2513]::ExplicitBug>::{closure#0}, !>
  10:        0x10f1af750 - std[e84bc52996b8b382]::panicking::begin_panic::<rustc_errors[3520987c35dd2513]::ExplicitBug>
  11:        0x10b1e40c0 - <rustc_errors[3520987c35dd2513]::diagnostic::BugAbort as rustc_errors[3520987c35dd2513]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:        0x10bc47970 - rustc_middle[e187904418cf7088]::util::bug::opt_span_bug_fmt::<rustc_span[984a238feadb13f5]::span_encoding::Span>::{closure#0}
  13:        0x10bc38d14 - rustc_middle[e187904418cf7088]::ty::context::tls::with_opt::<rustc_middle[e187904418cf7088]::util::bug::opt_span_bug_fmt<rustc_span[984a238feadb13f5]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:        0x10bc38ce0 - rustc_middle[e187904418cf7088]::ty::context::tls::with_context_opt::<rustc_middle[e187904418cf7088]::ty::context::tls::with_opt<rustc_middle[e187904418cf7088]::util::bug::opt_span_bug_fmt<rustc_span[984a238feadb13f5]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:        0x10f248fdc - rustc_middle[e187904418cf7088]::util::bug::bug_fmt
  16:        0x10afe6f30 - <rustc_const_eval[339e2f7468beb4be]::interpret::eval_context::InterpCx<rustc_const_eval[339e2f7468beb4be]::const_eval::machine::CompileTimeInterpreter>>::eval_operand
  17:        0x10afedfc8 - <rustc_const_eval[339e2f7468beb4be]::interpret::eval_context::InterpCx<rustc_const_eval[339e2f7468beb4be]::const_eval::machine::CompileTimeInterpreter>>::statement
  18:        0x10b015258 - rustc_const_eval[339e2f7468beb4be]::const_eval::eval_queries::eval_to_allocation_raw_provider
  19:        0x10c38bc68 - rustc_query_impl[a9dcee21c1ea9187]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a9dcee21c1ea9187]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e187904418cf7088]::query::erase::Erased<[u8; 24usize]>>
  20:        0x10c4595c4 - <rustc_query_impl[a9dcee21c1ea9187]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2} as core[fca7800875c611c6]::ops::function::FnOnce<(rustc_middle[e187904418cf7088]::ty::context::TyCtxt, rustc_middle[e187904418cf7088]::ty::ParamEnvAnd<rustc_middle[e187904418cf7088]::mir::interpret::GlobalId>)>>::call_once
  21:        0x10c3096a8 - rustc_query_system[3fe282a48bd1d9e8]::query::plumbing::try_execute_query::<rustc_query_impl[a9dcee21c1ea9187]::DynamicConfig<rustc_query_system[3fe282a48bd1d9e8]::query::caches::DefaultCache<rustc_middle[e187904418cf7088]::ty::ParamEnvAnd<rustc_middle[e187904418cf7088]::mir::interpret::GlobalId>, rustc_middle[e187904418cf7088]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[a9dcee21c1ea9187]::plumbing::QueryCtxt, true>
  22:        0x10c3f05b4 - rustc_query_impl[a9dcee21c1ea9187]::query_impl::eval_to_allocation_raw::get_query_incr::__rust_end_short_backtrace
  23:        0x10b013664 - rustc_const_eval[339e2f7468beb4be]::const_eval::eval_queries::eval_to_const_value_raw_provider
  24:        0x10c38c2b8 - rustc_query_impl[a9dcee21c1ea9187]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a9dcee21c1ea9187]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e187904418cf7088]::query::erase::Erased<[u8; 24usize]>>
  25:        0x10c459938 - <rustc_query_impl[a9dcee21c1ea9187]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2} as core[fca7800875c611c6]::ops::function::FnOnce<(rustc_middle[e187904418cf7088]::ty::context::TyCtxt, rustc_middle[e187904418cf7088]::ty::ParamEnvAnd<rustc_middle[e187904418cf7088]::mir::interpret::GlobalId>)>>::call_once
  26:        0x10c3096a8 - rustc_query_system[3fe282a48bd1d9e8]::query::plumbing::try_execute_query::<rustc_query_impl[a9dcee21c1ea9187]::DynamicConfig<rustc_query_system[3fe282a48bd1d9e8]::query::caches::DefaultCache<rustc_middle[e187904418cf7088]::ty::ParamEnvAnd<rustc_middle[e187904418cf7088]::mir::interpret::GlobalId>, rustc_middle[e187904418cf7088]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[a9dcee21c1ea9187]::plumbing::QueryCtxt, true>
  27:        0x10c3f0b80 - rustc_query_impl[a9dcee21c1ea9187]::query_impl::eval_to_const_value_raw::get_query_incr::__rust_end_short_backtrace
  28:        0x10b438d18 - std[e84bc52996b8b382]::panicking::try::<(), core[fca7800875c611c6]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[d96e6b3ae716122c]::sync::parallel::disabled::par_for_each_in<&[rustc_span[984a238feadb13f5]::def_id::LocalDefId], <rustc_middle[e187904418cf7088]::hir::map::Map>::par_body_owners<rustc_hir_analysis[c1c0f42cf391c6f]::check_crate::{closure#3}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>>
  29:        0x10b391720 - rustc_data_structures[d96e6b3ae716122c]::sync::parallel::disabled::par_for_each_in::<&[rustc_span[984a238feadb13f5]::def_id::LocalDefId], <rustc_middle[e187904418cf7088]::hir::map::Map>::par_body_owners<rustc_hir_analysis[c1c0f42cf391c6f]::check_crate::{closure#3}>::{closure#0}>
  30:        0x10b4afb38 - rustc_hir_analysis[c1c0f42cf391c6f]::check_crate
  31:        0x10b8b1e3c - rustc_interface[617d4417f0fbb0b3]::passes::analysis
  32:        0x10c38d89c - rustc_query_impl[a9dcee21c1ea9187]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a9dcee21c1ea9187]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e187904418cf7088]::query::erase::Erased<[u8; 1usize]>>
  33:        0x10c45bbf4 - <rustc_query_impl[a9dcee21c1ea9187]::query_impl::analysis::dynamic_query::{closure#2} as core[fca7800875c611c6]::ops::function::FnOnce<(rustc_middle[e187904418cf7088]::ty::context::TyCtxt, ())>>::call_once
  34:        0x10c2f3194 - rustc_query_system[3fe282a48bd1d9e8]::query::plumbing::try_execute_query::<rustc_query_impl[a9dcee21c1ea9187]::DynamicConfig<rustc_query_system[3fe282a48bd1d9e8]::query::caches::SingleCache<rustc_middle[e187904418cf7088]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a9dcee21c1ea9187]::plumbing::QueryCtxt, true>
  35:        0x10c3e0a94 - rustc_query_impl[a9dcee21c1ea9187]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  36:        0x10b148e38 - <rustc_middle[e187904418cf7088]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[17630cf877ef70bb]::run_compiler::{closure#0}::{closure#1}::{closure#3}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>
  37:        0x10b11ba88 - <rustc_interface[617d4417f0fbb0b3]::interface::Compiler>::enter::<rustc_driver_impl[17630cf877ef70bb]::run_compiler::{closure#0}::{closure#1}, core[fca7800875c611c6]::result::Result<core[fca7800875c611c6]::option::Option<rustc_interface[617d4417f0fbb0b3]::queries::Linker>, rustc_span[984a238feadb13f5]::ErrorGuaranteed>>
  38:        0x10b15f85c - <scoped_tls[710a08ee67d076ea]::ScopedKey<rustc_span[984a238feadb13f5]::SessionGlobals>>::set::<rustc_interface[617d4417f0fbb0b3]::util::run_in_thread_with_globals<rustc_interface[617d4417f0fbb0b3]::interface::run_compiler<core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>, rustc_driver_impl[17630cf877ef70bb]::run_compiler::{closure#0}>::{closure#1}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>
  39:        0x10b11b1d8 - rustc_span[984a238feadb13f5]::create_session_globals_then::<core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>, rustc_interface[617d4417f0fbb0b3]::util::run_in_thread_with_globals<rustc_interface[617d4417f0fbb0b3]::interface::run_compiler<core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>, rustc_driver_impl[17630cf877ef70bb]::run_compiler::{closure#0}>::{closure#1}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
  40:        0x10b134400 - std[e84bc52996b8b382]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[617d4417f0fbb0b3]::util::run_in_thread_with_globals<rustc_interface[617d4417f0fbb0b3]::interface::run_compiler<core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>, rustc_driver_impl[17630cf877ef70bb]::run_compiler::{closure#0}>::{closure#1}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>
  41:        0x10b167808 - <<std[e84bc52996b8b382]::thread::Builder>::spawn_unchecked_<rustc_interface[617d4417f0fbb0b3]::util::run_in_thread_with_globals<rustc_interface[617d4417f0fbb0b3]::interface::run_compiler<core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>, rustc_driver_impl[17630cf877ef70bb]::run_compiler::{closure#0}>::{closure#1}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[fca7800875c611c6]::result::Result<(), rustc_span[984a238feadb13f5]::ErrorGuaranteed>>::{closure#2} as core[fca7800875c611c6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:        0x101c94edc - std::sys::pal::unix::thread::Thread::new::thread_start::h50a0ef5291b272f3
  43:        0x1832f2f94 - __pthread_joiner_wake

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.79.0 (129f3b996 2024-06-10) running on aarch64-apple-darwin

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

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

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `blocks::is_block::IsBlock::nested_blocks::NO_BLOCKS`
#1 [eval_to_const_value_raw] simplifying constant for the type system `blocks::is_block::IsBlock::nested_blocks::NO_BLOCKS`
#2 [analysis] running analysis passes on this crate
end of query stack
@scouten scouten 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 Jul 10, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 10, 2024
scouten added a commit to scouten/asciidoc-parser that referenced this issue Jul 10, 2024
@saethlin saethlin added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Jul 10, 2024
@saethlin
Copy link
Member

Minimized:

enum Block {
    Section(DoesNotExist),
}

trait IsBlock {
    fn nested_blocks(&self) -> impl Iterator<Item = &Block> {
        const NO_BLOCKS: &[Block] = &[];
        NO_BLOCKS.iter()
    }
}

@saethlin
Copy link
Member

Bisection indicates this was fixed by #124516, which looks right. Thanks for the report!

@saethlin saethlin removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants