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 with range pattern inside struct initializer at compile time #113012

Closed
mpfaff opened this issue Jun 24, 2023 · 3 comments · Fixed by #113107
Closed

ICE with range pattern inside struct initializer at compile time #113012

mpfaff opened this issue Jun 24, 2023 · 3 comments · Fixed by #113107
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mpfaff
Copy link

mpfaff commented Jun 24, 2023

Code

struct Foo(());

const FOO: Foo = Foo(match 0 {
    0.. => (),
    _ => (),
});

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (22e9fe644 2023-06-23)
binary: rustc
commit-hash: 22e9fe644ea710eec50cb0aabcae7fa8dd9fd675
commit-date: 2023-06-23
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error: internal compiler error: compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs:355:32: expected ConstKind::Param here, found Const { ty: i32, kind: Leaf(0x00000000) }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7f89bdb67e31 - std::backtrace_rs::backtrace::libunwind::trace::h45c8b5b393354aaa
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f89bdb67e31 - std::backtrace_rs::backtrace::trace_unsynchronized::hc5cde6aeff03cc23
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f89bdb67e31 - std::sys_common::backtrace::_print_fmt::h86fd79bdeff6c899
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f89bdb67e31 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0f1168665e8c8865
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f89bdbc95df - core::fmt::rt::Argument::fmt::hfed1a51422c978b7
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/fmt/rt.rs:138:9
   5:     0x7f89bdbc95df - core::fmt::write::h4dfc2a0c62cf3fd6
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f89bdb5a967 - std::io::Write::write_fmt::ha45cc30dd6a81686
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/io/mod.rs:1714:15
   7:     0x7f89bdb67c45 - std::sys_common::backtrace::_print::h14294ae8d055d04e
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f89bdb67c45 - std::sys_common::backtrace::print::hf007ea148056754d
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f89bdb6a9f3 - std::panicking::default_hook::{{closure}}::h12f0e86c17019fae
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:269:22
  10:     0x7f89bdb6a784 - std::panicking::default_hook::h3e363e70e8823128
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:288:9
  11:     0x7f89c0e03eab - rustc_driver_impl[1ee18bc64acaad37]::install_ice_hook::{closure#0}
  12:     0x7f89bdb6b21e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6345ba7ef09e0a3b
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:2007:9
  13:     0x7f89bdb6b21e - std::panicking::rust_panic_with_hook::he3112cb9ec41f5a5
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/panicking.rs:709:13
  14:     0x7f89c13d4581 - std[590ba7ead67831d4]::panicking::begin_panic::<rustc_errors[d1d2cf2f3224cafd]::ExplicitBug>::{closure#0}
  15:     0x7f89c13d1856 - std[590ba7ead67831d4]::sys_common::backtrace::__rust_end_short_backtrace::<std[590ba7ead67831d4]::panicking::begin_panic<rustc_errors[d1d2cf2f3224cafd]::ExplicitBug>::{closure#0}, !>
  16:     0x7f89c13c2ce6 - std[590ba7ead67831d4]::panicking::begin_panic::<rustc_errors[d1d2cf2f3224cafd]::ExplicitBug>
  17:     0x7f89c1325a14 - <rustc_errors[d1d2cf2f3224cafd]::HandlerInner>::bug::<alloc[2c2f5c796e500044]::string::String>
  18:     0x7f89c1325896 - <rustc_errors[d1d2cf2f3224cafd]::Handler>::bug::<alloc[2c2f5c796e500044]::string::String>
  19:     0x7f89c134870c - rustc_middle[aeb3147772634dcd]::util::bug::opt_span_bug_fmt::<rustc_span[8155bebf48a1eb91]::span_encoding::Span>::{closure#0}
  20:     0x7f89c134776a - rustc_middle[aeb3147772634dcd]::ty::context::tls::with_opt::<rustc_middle[aeb3147772634dcd]::util::bug::opt_span_bug_fmt<rustc_span[8155bebf48a1eb91]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f89c134773a - rustc_middle[aeb3147772634dcd]::ty::context::tls::with_context_opt::<rustc_middle[aeb3147772634dcd]::ty::context::tls::with_opt<rustc_middle[aeb3147772634dcd]::util::bug::opt_span_bug_fmt<rustc_span[8155bebf48a1eb91]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f89bf1c42ad - rustc_middle[aeb3147772634dcd]::util::bug::bug_fmt
  23:     0x7f89c01cd3cb - rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::in_operand::<rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::CustomEq, <rustc_const_eval[89eb266586069ed2]::transform::check_consts::resolver::TransferFunction<rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::CustomEq> as rustc_middle[aeb3147772634dcd]::mir::visit::Visitor>::visit_assign::{closure#0}>
  24:     0x7f89c01cc0c3 - rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::in_rvalue::<rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::CustomEq, <rustc_const_eval[89eb266586069ed2]::transform::check_consts::resolver::TransferFunction<rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::CustomEq> as rustc_middle[aeb3147772634dcd]::mir::visit::Visitor>::visit_assign::{closure#0}>
  25:     0x7f89c01cae7e - <rustc_const_eval[89eb266586069ed2]::transform::check_consts::resolver::FlowSensitiveAnalysis<rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::CustomEq> as rustc_mir_dataflow[19ecd5adbca4a1a5]::framework::Analysis>::apply_statement_effect
  26:     0x7f89c01c8ffc - <rustc_mir_dataflow[19ecd5adbca4a1a5]::framework::engine::Engine<rustc_const_eval[89eb266586069ed2]::transform::check_consts::resolver::FlowSensitiveAnalysis<rustc_const_eval[89eb266586069ed2]::transform::check_consts::qualifs::CustomEq>>>::iterate_to_fixpoint
  27:     0x7f89c01bafe4 - <rustc_const_eval[89eb266586069ed2]::transform::check_consts::check::Checker>::qualifs_in_return_place
  28:     0x7f89bf00e5d7 - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[30672f8f3d90a755]::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 5usize]>>
  29:     0x7f89bf00e3c1 - <rustc_query_impl[30672f8f3d90a755]::query_impl::mir_const_qualif::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, rustc_span[8155bebf48a1eb91]::def_id::DefId)>>::call_once
  30:     0x7f89bef92444 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::DefaultCache<rustc_span[8155bebf48a1eb91]::def_id::DefId, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 5usize]>>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, true>
  31:     0x7f89bef91ad0 - rustc_query_impl[30672f8f3d90a755]::query_impl::mir_const_qualif::get_query_incr::__rust_end_short_backtrace
  32:     0x7f89bf011dc9 - rustc_mir_transform[ea407ab7eecac49d]::mir_promoted
  33:     0x7f89bee32f01 - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[30672f8f3d90a755]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 16usize]>>
  34:     0x7f89bee32ed2 - <rustc_query_impl[30672f8f3d90a755]::query_impl::mir_promoted::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, rustc_span[8155bebf48a1eb91]::def_id::LocalDefId)>>::call_once
  35:     0x7f89c16c674c - <rustc_query_system[29d9bde875297da0]::query::plumbing::execute_job_incr<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::VecCache<rustc_span[8155bebf48a1eb91]::def_id::CrateNum, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt>::{closure#2}::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<((rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::VecCache<rustc_span[8155bebf48a1eb91]::def_id::CrateNum, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 24usize]>>, false, false, false>), rustc_span[8155bebf48a1eb91]::def_id::CrateNum)>>::call_once
  36:     0x7f89c02e4628 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::VecCache<rustc_span[8155bebf48a1eb91]::def_id::LocalDefId, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, true>
  37:     0x7f89c078ef0a - rustc_query_impl[30672f8f3d90a755]::query_impl::mir_promoted::get_query_incr::__rust_end_short_backtrace
  38:     0x7f89bf702a2c - rustc_borrowck[5b525c22e5b16615]::mir_borrowck
  39:     0x7f89bee3e42e - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[30672f8f3d90a755]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 8usize]>>
  40:     0x7f89bee3e3fe - <rustc_query_impl[30672f8f3d90a755]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, rustc_span[8155bebf48a1eb91]::def_id::LocalDefId)>>::call_once
  41:     0x7f89bfcad166 - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::VecCache<rustc_span[8155bebf48a1eb91]::def_id::LocalDefId, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, true>
  42:     0x7f89c07767f9 - rustc_query_impl[30672f8f3d90a755]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  43:     0x7f89c029073e - rustc_data_structures[d01ec42de3a14370]::sync::par_for_each_in::<&[rustc_span[8155bebf48a1eb91]::def_id::LocalDefId], <rustc_middle[aeb3147772634dcd]::hir::map::Map>::par_body_owners<rustc_interface[3e44238a9783f3c8]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>
  44:     0x7f89c0290456 - <rustc_session[91ea302e4bbb4392]::session::Session>::time::<(), rustc_interface[3e44238a9783f3c8]::passes::analysis::{closure#1}>
  45:     0x7f89c028fb8e - rustc_interface[3e44238a9783f3c8]::passes::analysis
  46:     0x7f89c02dc83a - rustc_query_impl[30672f8f3d90a755]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[30672f8f3d90a755]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 1usize]>>
  47:     0x7f89c02dc829 - <rustc_query_impl[30672f8f3d90a755]::query_impl::analysis::dynamic_query::{closure#2} as core[db7c5f9f8e26b951]::ops::function::FnOnce<(rustc_middle[aeb3147772634dcd]::ty::context::TyCtxt, ())>>::call_once
  48:     0x7f89c05e1bbf - rustc_query_system[29d9bde875297da0]::query::plumbing::try_execute_query::<rustc_query_impl[30672f8f3d90a755]::DynamicConfig<rustc_query_system[29d9bde875297da0]::query::caches::SingleCache<rustc_middle[aeb3147772634dcd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[30672f8f3d90a755]::plumbing::QueryCtxt, true>
  49:     0x7f89c05e1764 - rustc_query_impl[30672f8f3d90a755]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  50:     0x7f89c0428485 - <rustc_middle[aeb3147772634dcd]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
  51:     0x7f89c0003f4b - <rustc_interface[3e44238a9783f3c8]::interface::Compiler>::enter::<rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}::{closure#2}, core[db7c5f9f8e26b951]::result::Result<core[db7c5f9f8e26b951]::option::Option<rustc_interface[3e44238a9783f3c8]::queries::Linker>, rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
  52:     0x7f89bffffd99 - rustc_span[8155bebf48a1eb91]::set_source_map::<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  53:     0x7f89bffff8c5 - <scoped_tls[5f3106920672553]::ScopedKey<rustc_span[8155bebf48a1eb91]::SessionGlobals>>::set::<rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
  54:     0x7f89bfffeee6 - std[590ba7ead67831d4]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3e44238a9783f3c8]::util::run_in_thread_pool_with_globals<rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>
  55:     0x7f89c0673945 - <<std[590ba7ead67831d4]::thread::Builder>::spawn_unchecked_<rustc_interface[3e44238a9783f3c8]::util::run_in_thread_pool_with_globals<rustc_interface[3e44238a9783f3c8]::interface::run_compiler<core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>, rustc_driver_impl[1ee18bc64acaad37]::run_compiler::{closure#1}>::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[db7c5f9f8e26b951]::result::Result<(), rustc_span[8155bebf48a1eb91]::ErrorGuaranteed>>::{closure#1} as core[db7c5f9f8e26b951]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7f89bdb75695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2e6f8aee19cb9bca
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:1993:9
  57:     0x7f89bdb75695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4548c5cdbeb5a136
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/alloc/src/boxed.rs:1993:9
  58:     0x7f89bdb75695 - std::sys::unix::thread::Thread::new::thread_start::h57734a91bfb8a041
                               at /rustc/22e9fe644ea710eec50cb0aabcae7fa8dd9fd675/library/std/src/sys/unix/thread.rs:108:17
  59:     0x7f89bd8bcbb5 - <unknown>
  60:     0x7f89bd93ed90 - <unknown>
  61:                0x0 - <unknown>

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.72.0-nightly (22e9fe644 2023-06-23) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C incremental=[REDACTED] -Z macro-backtrace -Z proc-macro-backtrace -C target-cpu=native -C link-arg=-fuse-ld=lld

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

query stack during panic:
#0 [mir_const_qualif] const checking `FOO`
#1 [mir_promoted] promoting constants in MIR for `FOO`
#2 [mir_borrowck] borrow-checking `FOO`
#3 [analysis] running analysis passes on this crate
end of query stack
@mpfaff mpfaff 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 Jun 24, 2023
@mj10021
Copy link
Contributor

mj10021 commented Jun 25, 2023

@rustbot claim

@rustbot rustbot added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 25, 2023
@mj10021
Copy link
Contributor

mj10021 commented Jun 25, 2023

regressed in #111913

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

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) ❄️ P-medium Medium priority 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.

4 participants