Skip to content

ICE on rust 1.65.0, thread 'rustc' panicked at 'assertion failed: key.param_env.is_const()', compiler/rustc_const_eval/src/const_eval/eval_queries.rs:270:5 #111498

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

Closed
sorhawell opened this issue May 12, 2023 · 5 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

@sorhawell
Copy link

This is probably old news, but I was not entirely sure. For good measures I submit the issue, and it could be closed if so.

I see this error when compiling a crate called argminmax with rust 1.65.0 . Any other version or opt-level<2 does not give an error.
I apologize for not making error more containted, but I was not able to pick a part the crate and reproduce the error.

Code

// simple rust project with error https://github.com/sorhawell/use_argminmax/blob/master/Cargo.toml
fn main() {
    println!("Hello, world!");

    use argminmax::ArgMinMax; // import trait

    let arr: Vec<i32> = (0..200_000).collect(); // create a vector

    let (min, max) = arr.argminmax(); // apply extension

    println!("min: {}, max: {}", min, max);
    println!("arr[min]: {}, arr[max]: {}", arr[min], arr[max]);
}

Meta

Only present in rust 1.65.0 with opt-level=2 and above.
Found on linux and darwin

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02) running on x86_64-apple-darwin

Error output

See also a full error log here here:

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.65.0 (897e37553 2022-11-02) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no

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

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `simd::simd_i8::sse::<impl at /Users/sorenwelling/Documents/projs/argminmax/src/simd/generic.rs:776:9: 802:10>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant  |  = note: this failure-note originates in the macro `impl_SIMDArgMinMax` (in Nightly builds, run with -Z macro-backtrace for more info)

#2 [optimized_mir] optimizing MIR for `simd::simd_i8::sse::<impl at /Users/sorenwelling/Documents/projs/argminmax/src/simd/generic.rs:776:9: 802:10>::argminmax`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
thread 'rustc' panicked at 'assertion failed: key.param_env.is_const()', compiler/rustc_const_eval/src/const_eval/eval_queries.rs:270:5
stack backtrace:
   0:        0x1097bd662 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd2e8cbde22b780fc
   1:        0x109814d2a - core::fmt::write::hd6692086cdd356a7
   2:        0x1097af6cc - std::io::Write::write_fmt::h6043124a2486acbb
   3:        0x1097c054b - std::panicking::default_hook::{{closure}}::h87a12b8b06887dd7
   4:        0x1097c0257 - std::panicking::default_hook::h7f68dad17e0bfaa4
   5:        0x11ad873ca - rustc_driver[16e15c4795dce443]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x1097c0c7e - std::panicking::rust_panic_with_hook::hd57427cbbfc3717a
   7:        0x1097c0ae2 - std::panicking::begin_panic_handler::{{closure}}::h33aab6d04e2bba70
   8:        0x1097bdaf8 - std::sys_common::backtrace::__rust_end_short_backtrace::h0e7a76f927db9964
   9:        0x1097c07ed - _rust_begin_unwind
  10:        0x10983f8d3 - core::panicking::panic_fmt::hcf6f3c517c6f3cb3
  11:        0x10983f7b7 - core::panicking::panic::h46977cf6deabee02
  12:        0x11e34a993 - rustc_const_eval[17aaad9da6681dfa]::const_eval::eval_queries::eval_to_allocation_raw_provider
  13:        0x11e50d495 - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::try_execute_query::<rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt, rustc_query_system[dd5f4cbbefd3ac00]::query::caches::DefaultCache<rustc_middle[bb0c5e8c48bbcb6f]::ty::ParamEnvAnd<rustc_middle[bb0c5e8c48bbcb6f]::mir::interpret::GlobalId>, core[bb3d6b31f0e973c8]::result::Result<rustc_middle[bb0c5e8c48bbcb6f]::mir::interpret::value::ConstAlloc, rustc_middle[bb0c5e8c48bbcb6f]::mir::interpret::error::ErrorHandled>>>
  14:        0x11e62b1ba - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::get_query::<rustc_query_impl[cb317dc1728e98be]::queries::eval_to_allocation_raw, rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt>
  15:        0x11e8bba91 - <rustc_query_impl[cb317dc1728e98be]::Queries as rustc_middle[bb0c5e8c48bbcb6f]::ty::query::QueryEngine>::eval_to_allocation_raw
  16:        0x11e357e1f - rustc_const_eval[17aaad9da6681dfa]::const_eval::eval_to_valtree
  17:        0x11e375093 - <rustc_const_eval[17aaad9da6681dfa]::provide::{closure#0} as core[bb3d6b31f0e973c8]::ops::function::FnOnce<(rustc_middle[bb0c5e8c48bbcb6f]::ty::context::TyCtxt, rustc_middle[bb0c5e8c48bbcb6f]::ty::ParamEnvAnd<rustc_middle[bb0c5e8c48bbcb6f]::mir::interpret::GlobalId>)>>::call_once
  18:        0x11e50be23 - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::try_execute_query::<rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt, rustc_query_system[dd5f4cbbefd3ac00]::query::caches::DefaultCache<rustc_middle[bb0c5e8c48bbcb6f]::ty::ParamEnvAnd<rustc_middle[bb0c5e8c48bbcb6f]::mir::interpret::GlobalId>, core[bb3d6b31f0e973c8]::result::Result<core[bb3d6b31f0e973c8]::option::Option<rustc_middle[bb0c5e8c48bbcb6f]::ty::consts::valtree::ValTree>, rustc_middle[bb0c5e8c48bbcb6f]::mir::interpret::error::ErrorHandled>>>
  19:        0x11e62286d - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::get_query::<rustc_query_impl[cb317dc1728e98be]::queries::eval_to_valtree, rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt>
  20:        0x11e8bbb91 - <rustc_query_impl[cb317dc1728e98be]::Queries as rustc_middle[bb0c5e8c48bbcb6f]::ty::query::QueryEngine>::eval_to_valtree
  21:        0x11d62fbfc - <rustc_const_eval[17aaad9da6681dfa]::interpret::eval_context::InterpCx<rustc_mir_transform[2605375681be2b59]::const_prop::ConstPropMachine>>::mir_const_to_op
  22:        0x11d62ec3b - <rustc_const_eval[17aaad9da6681dfa]::interpret::eval_context::InterpCx<rustc_mir_transform[2605375681be2b59]::const_prop::ConstPropMachine>>::eval_operand
  23:        0x11d622055 - <rustc_const_eval[17aaad9da6681dfa]::interpret::eval_context::InterpCx<rustc_mir_transform[2605375681be2b59]::const_prop::ConstPropMachine>>::eval_rvalue_into_place
  24:        0x11d6c1341 - <rustc_mir_transform[2605375681be2b59]::const_prop::ConstPropagator as rustc_middle[bb0c5e8c48bbcb6f]::mir::visit::MutVisitor>::visit_statement
  25:        0x11d6d25cb - <rustc_mir_transform[2605375681be2b59]::const_prop::ConstProp as rustc_middle[bb0c5e8c48bbcb6f]::mir::MirPass>::run_pass
  26:        0x11d7370a7 - rustc_mir_transform[2605375681be2b59]::pass_manager::run_passes_inner
  27:        0x11d6ffcaa - rustc_mir_transform[2605375681be2b59]::optimized_mir
  28:        0x11e578bd5 - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::try_execute_query::<rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt, rustc_query_system[dd5f4cbbefd3ac00]::query::caches::DefaultCache<rustc_span[e569a852badd08b3]::def_id::DefId, &rustc_middle[bb0c5e8c48bbcb6f]::mir::Body>>
  29:        0x11e620645 - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::get_query::<rustc_query_impl[cb317dc1728e98be]::queries::optimized_mir, rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt>
  30:        0x11f4de45f - <rustc_middle[bb0c5e8c48bbcb6f]::ty::context::TyCtxt>::instance_mir
  31:        0x11d5c4bc0 - rustc_monomorphize[fc10be4fb6fc1379]::collector::collect_neighbours
  32:        0x11d5c2b76 - rustc_monomorphize[fc10be4fb6fc1379]::collector::collect_items_rec
  33:        0x11d5ee76c - std[550525b9dd91a68e]::panicking::try::<(), core[bb3d6b31f0e973c8]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[12a8d38a9c012388]::sync::par_for_each_in<alloc[bc7f897b574022f6]::vec::Vec<rustc_middle[bb0c5e8c48bbcb6f]::mir::mono::MonoItem>, rustc_monomorphize[fc10be4fb6fc1379]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>
  34:        0x11d5d583b - <rustc_session[7981c40e681cffbf]::session::Session>::time::<(), rustc_monomorphize[fc10be4fb6fc1379]::collector::collect_crate_mono_items::{closure#1}>
  35:        0x11d5c011c - rustc_monomorphize[fc10be4fb6fc1379]::collector::collect_crate_mono_items
  36:        0x11d5d18cf - rustc_monomorphize[fc10be4fb6fc1379]::partitioning::collect_and_partition_mono_items
  37:        0x11e5c7b71 - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::try_execute_query::<rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt, rustc_query_system[dd5f4cbbefd3ac00]::query::caches::DefaultCache<(), (&std[550525b9dd91a68e]::collections::hash::set::HashSet<rustc_span[e569a852badd08b3]::def_id::DefId, core[bb3d6b31f0e973c8]::hash::BuildHasherDefault<rustc_hash[adf28cd9458a09b0]::FxHasher>>, &[rustc_middle[bb0c5e8c48bbcb6f]::mir::mono::CodegenUnit])>>
  38:        0x11e630dd3 - rustc_query_system[dd5f4cbbefd3ac00]::query::plumbing::get_query::<rustc_query_impl[cb317dc1728e98be]::queries::collect_and_partition_mono_items, rustc_query_impl[cb317dc1728e98be]::plumbing::QueryCtxt>
  39:        0x11e8bd1be - <rustc_query_impl[cb317dc1728e98be]::Queries as rustc_middle[bb0c5e8c48bbcb6f]::ty::query::QueryEngine>::collect_and_partition_mono_items
  40:        0x11afc5b0c - rustc_codegen_ssa[1c3c03b57650ec71]::base::codegen_crate::<rustc_codegen_llvm[389602dbb09ae164]::LlvmCodegenBackend>
  41:        0x11af73732 - <rustc_codegen_llvm[389602dbb09ae164]::LlvmCodegenBackend as rustc_codegen_ssa[1c3c03b57650ec71]::traits::backend::CodegenBackend>::codegen_crate
  42:        0x11aec3512 - <rustc_session[7981c40e681cffbf]::session::Session>::time::<alloc[bc7f897b574022f6]::boxed::Box<dyn core[bb3d6b31f0e973c8]::any::Any>, rustc_interface[10c69fc32fc6154b]::passes::start_codegen::{closure#0}>
  43:        0x11aec1306 - <rustc_interface[10c69fc32fc6154b]::passes::QueryContext>::enter::<<rustc_interface[10c69fc32fc6154b]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[bb3d6b31f0e973c8]::result::Result<alloc[bc7f897b574022f6]::boxed::Box<dyn core[bb3d6b31f0e973c8]::any::Any>, rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>>
  44:        0x11ae9dc2c - <rustc_interface[10c69fc32fc6154b]::queries::Queries>::ongoing_codegen
  45:        0x11ad8e21f - rustc_interface[10c69fc32fc6154b]::interface::create_compiler_and_run::<core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>, rustc_driver[16e15c4795dce443]::run_compiler::{closure#1}>
  46:        0x11adff065 - <scoped_tls[7d2a033726ec5167]::ScopedKey<rustc_span[e569a852badd08b3]::SessionGlobals>>::set::<rustc_interface[10c69fc32fc6154b]::interface::run_compiler<core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>, rustc_driver[16e15c4795dce443]::run_compiler::{closure#1}>::{closure#0}, core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>>
  47:        0x11adc416a - std[550525b9dd91a68e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[10c69fc32fc6154b]::util::run_in_thread_pool_with_globals<rustc_interface[10c69fc32fc6154b]::interface::run_compiler<core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>, rustc_driver[16e15c4795dce443]::run_compiler::{closure#1}>::{closure#0}, core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>>::{closure#0}, core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>>
  48:        0x11adc7898 - <<std[550525b9dd91a68e]::thread::Builder>::spawn_unchecked_<rustc_interface[10c69fc32fc6154b]::util::run_in_thread_pool_with_globals<rustc_interface[10c69fc32fc6154b]::interface::run_compiler<core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>, rustc_driver[16e15c4795dce443]::run_compiler::{closure#1}>::{closure#0}, core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>>::{closure#0}, core[bb3d6b31f0e973c8]::result::Result<(), rustc_errors[a43e87068ce59fd]::ErrorGuaranteed>>::{closure#1} as core[bb3d6b31f0e973c8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:        0x1097c9bb7 - std::sys::unix::thread::Thread::new::thread_start::haa45038b11bc331d
  50:     0x7ff81c13c4e1 - __pthread_start
@sorhawell sorhawell 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 12, 2023
@clubby789
Copy link
Contributor

Hmm, this has the same error as #105847 but the fix for that landed in 1.68. Bisecting the fix gives us this

found 7 bors merge commits in the specified range
  commit[0] 2022-09-22: Auto merge of #98840 - cjgillot:span-inline-ctxt, r=wesleywiser
  commit[1] 2022-09-23: Auto merge of #101708 - compiler-errors:issue-101696, r=jackh726
  commit[2] 2022-09-23: Auto merge of #100488 - khyperia:invalid-calling-convention-help-message, r=nagisa,jyn514
  commit[3] 2022-09-23: Auto merge of #102150 - matthiaskrgr:rollup-6xmd8f3, r=matthiaskrgr
  commit[4] 2022-09-23: Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgr
  commit[5] 2022-09-23: Auto merge of #102056 - b-naber:unevaluated, r=lcnr
  commit[6] 2022-09-23: Auto merge of #102192 - matthiaskrgr:rollup-0ctjzco, r=matthiaskrgr

Out of those, there's a couple of merges related to const: #102133, #102137,

@matthiaskrgr
Copy link
Member

Does this still tigger with the latest stable rustc 1.69.0 ?

@sorhawell
Copy link
Author

sorhawell commented May 12, 2023

Does this still tigger with the latest stable rustc 1.69.0 ?

any stable version from 1.62.0 to 1.69.0 or nightly does not trigger this error.
except for 1.65.0 with opt-level = 2 or 3.

@compiler-errors
Copy link
Member

I don't think we typically keep error reports for old versions of rust open. Thanks @sorhawell for filing this bug, but you probably should just upgrade to the latest stable 😸

@sorhawell
Copy link
Author

@compiler-errors All good, thank you for taking a look. I was not sure of the rust policies for earlier versions. I'm partially stuck in the past, because in R-world the main repository CRAN and its mandatory build system use a specific Debian distribution.

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

4 participants