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: argument of integer logarithm must be positive #115351

Closed
matthiaskrgr opened this issue Aug 29, 2023 · 2 comments
Closed

ICE: argument of integer logarithm must be positive #115351

matthiaskrgr opened this issue Aug 29, 2023 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Aug 29, 2023

Code

rustc code.rs -Ztrait-solver=next-coherence --crate-type lib

#![recursion_limit = "0"]
struct Foo {
    x: u32,
}

impl Eq for Foo {}

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (8550f15e1 2023-08-27)
binary: rustc
commit-hash: 8550f15e148407159af401e02b1d9259762b3496
commit-date: 2023-08-27
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Error output

None
Backtrace

thread 'rustc' panicked at compiler/rustc_trait_selection/src/solve/search_graph/mod.rs:56:59:
argument of integer logarithm must be positive
stack backtrace:
   0:     0x7fcc6b162fac - std::backtrace_rs::backtrace::libunwind::trace::h3cdefe4fb23a6b3a
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fcc6b162fac - std::backtrace_rs::backtrace::trace_unsynchronized::h6ede82d100910221
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcc6b162fac - std::sys_common::backtrace::_print_fmt::h564b5755e214dbd5
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fcc6b162fac - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3bb0b7ee87d68aed
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fcc6b1c91dc - core::fmt::rt::Argument::fmt::h903113224f096afc
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/core/src/fmt/rt.rs:138:9
   5:     0x7fcc6b1c91dc - core::fmt::write::h2f2c8ce81ee50b3f
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fcc6b155bbe - std::io::Write::write_fmt::hb21406841559e330
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/io/mod.rs:1714:15
   7:     0x7fcc6b162d94 - std::sys_common::backtrace::_print::hb55767b531e2566e
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fcc6b162d94 - std::sys_common::backtrace::print::hd074e43f409a127f
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fcc6b165e8a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h046d8531ad053f91
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/panicking.rs:278:22
  10:     0x7fcc6b165b78 - std::panicking::panic_hook_with_disk_dump::hfb9471961dbb25bb
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/panicking.rs:312:9
  11:     0x7fcc6e34b9f9 - <rustc_driver_impl[7bf055920e34ea09]::install_ice_hook::{closure#0} as core[bf64e138fa002a57]::ops::function::FnOnce<(&core[bf64e138fa002a57]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7fcc6b166731 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h72926f082835a92c
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/alloc/src/boxed.rs:2021:9
  13:     0x7fcc6b166731 - std::panicking::rust_panic_with_hook::ha6d24ea6e40ae256
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/panicking.rs:733:13
  14:     0x7fcc6b166471 - std::panicking::begin_panic_handler::{{closure}}::h758bfce84ed64015
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/panicking.rs:619:13
  15:     0x7fcc6b1634d6 - std::sys_common::backtrace::__rust_end_short_backtrace::h8ddfdd46661af412
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fcc6b166202 - rust_begin_unwind
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/panicking.rs:617:5
  17:     0x7fcc6b1c55c3 - core::panicking::panic_fmt::h19261c4223ee6e3a
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/core/src/panicking.rs:67:14
  18:     0x7fcc6b1bfa3b - core::num::int_log10::panic_for_nonpositive_argument::h9e05331fcc9cc3eb
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/core/src/num/int_log10.rs:147:5
  19:     0x7fcc6ef34907 - <rustc_trait_selection[6963e92147fbe2af]::solve::search_graph::SearchGraph>::new
  20:     0x7fcc6eeaa55a - <rustc_trait_selection[6963e92147fbe2af]::solve::eval_ctxt::EvalCtxt>::enter_root::<core[bf64e138fa002a57]::result::Result<(bool, rustc_middle[efca071ca22fc86a]::traits::solve::Certainty, alloc[9ec5b6ee51db475b]::vec::Vec<rustc_middle[efca071ca22fc86a]::traits::solve::Goal<rustc_middle[efca071ca22fc86a]::ty::Predicate>>), rustc_middle[efca071ca22fc86a]::traits::query::NoSolution>, <rustc_infer[4430fe82bd2754ca]::infer::InferCtxt as rustc_trait_selection[6963e92147fbe2af]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal::{closure#0}::{closure#0}>
  21:     0x7fcc6ef2e6a4 - <rustc_infer[4430fe82bd2754ca]::infer::InferCtxt as rustc_trait_selection[6963e92147fbe2af]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal
  22:     0x7fcc6eeab896 - <rustc_trait_selection[6963e92147fbe2af]::solve::fulfill::FulfillmentCtxt as rustc_infer[4430fe82bd2754ca]::traits::engine::TraitEngine>::select_where_possible
  23:     0x7fcc6cc4901b - <rustc_infer[4430fe82bd2754ca]::infer::InferCtxt as rustc_trait_selection[6963e92147fbe2af]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  24:     0x7fcc6d7a0465 - <core[bf64e138fa002a57]::iter::adapters::flatten::FlattenCompat<_, _> as core[bf64e138fa002a57]::iter::traits::iterator::Iterator>::try_fold::flatten::<core[bf64e138fa002a57]::slice::iter::Iter<(rustc_middle[efca071ca22fc86a]::ty::Predicate, rustc_span[a8290ff303d9da59]::span_encoding::Span)>, (), core[bf64e138fa002a57]::ops::control_flow::ControlFlow<rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>>, core[bf64e138fa002a57]::iter::adapters::map::map_try_fold<&(rustc_middle[efca071ca22fc86a]::ty::Predicate, rustc_span[a8290ff303d9da59]::span_encoding::Span), rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>, (), core[bf64e138fa002a57]::ops::control_flow::ControlFlow<rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>>, rustc_trait_selection[6963e92147fbe2af]::traits::coherence::impl_intersection_has_impossible_obligation::{closure#0}, core[bf64e138fa002a57]::iter::traits::iterator::Iterator::find::check<rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>, &mut rustc_trait_selection[6963e92147fbe2af]::traits::coherence::impl_intersection_has_impossible_obligation::{closure#1}>::{closure#0}>::{closure#0}>::{closure#0}
  25:     0x7fcc6d7a0299 - <core[bf64e138fa002a57]::iter::adapters::map::Map<core[bf64e138fa002a57]::iter::adapters::flatten::Flatten<core[bf64e138fa002a57]::array::iter::IntoIter<&alloc[9ec5b6ee51db475b]::vec::Vec<(rustc_middle[efca071ca22fc86a]::ty::Predicate, rustc_span[a8290ff303d9da59]::span_encoding::Span)>, 2usize>>, rustc_trait_selection[6963e92147fbe2af]::traits::coherence::impl_intersection_has_impossible_obligation::{closure#0}> as core[bf64e138fa002a57]::iter::traits::iterator::Iterator>::try_fold::<(), core[bf64e138fa002a57]::iter::traits::iterator::Iterator::find::check<rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>, &mut rustc_trait_selection[6963e92147fbe2af]::traits::coherence::impl_intersection_has_impossible_obligation::{closure#1}>::{closure#0}, core[bf64e138fa002a57]::ops::control_flow::ControlFlow<rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>>>
  26:     0x7fcc6d5ca35c - rustc_trait_selection[6963e92147fbe2af]::traits::coherence::impl_intersection_has_impossible_obligation
  27:     0x7fcc6d5ca27f - <rustc_trait_selection[6963e92147fbe2af]::traits::select::SelectionContext>::with_treat_inductive_cycle_as::<core[bf64e138fa002a57]::option::Option<rustc_infer[4430fe82bd2754ca]::traits::Obligation<rustc_middle[efca071ca22fc86a]::ty::Predicate>>, rustc_trait_selection[6963e92147fbe2af]::traits::coherence::overlap::{closure#0}>
  28:     0x7fcc6d5c90c2 - rustc_trait_selection[6963e92147fbe2af]::traits::coherence::overlap
  29:     0x7fcc6d5d4823 - <rustc_middle[efca071ca22fc86a]::traits::specialization_graph::Children as rustc_trait_selection[6963e92147fbe2af]::traits::specialize::specialization_graph::ChildrenExt>::insert
  30:     0x7fcc6d5d2d07 - <rustc_middle[efca071ca22fc86a]::traits::specialization_graph::Graph as rustc_trait_selection[6963e92147fbe2af]::traits::specialize::specialization_graph::GraphExt>::insert
  31:     0x7fcc6d5d1d0d - rustc_trait_selection[6963e92147fbe2af]::traits::specialize::specialization_graph_provider
  32:     0x7fcc6d7a000b - rustc_query_impl[482b33e8cb77ad03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[482b33e8cb77ad03]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[efca071ca22fc86a]::query::erase::Erased<[u8; 8usize]>>
  33:     0x7fcc6d79ffe1 - <rustc_query_impl[482b33e8cb77ad03]::query_impl::specialization_graph_of::dynamic_query::{closure#2} as core[bf64e138fa002a57]::ops::function::FnOnce<(rustc_middle[efca071ca22fc86a]::ty::context::TyCtxt, rustc_span[a8290ff303d9da59]::def_id::DefId)>>::call_once
  34:     0x7fcc6c43e535 - rustc_query_system[6e0ae15f65f556c9]::query::plumbing::try_execute_query::<rustc_query_impl[482b33e8cb77ad03]::DynamicConfig<rustc_query_system[6e0ae15f65f556c9]::query::caches::DefaultCache<rustc_span[a8290ff303d9da59]::def_id::DefId, rustc_middle[efca071ca22fc86a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[482b33e8cb77ad03]::plumbing::QueryCtxt, false>
  35:     0x7fcc6dcc8842 - rustc_query_impl[482b33e8cb77ad03]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fcc6d981b65 - rustc_hir_analysis[2a47ce24b01765db]::coherence::coherent_trait
  37:     0x7fcc6cfcadc1 - rustc_query_impl[482b33e8cb77ad03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[482b33e8cb77ad03]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[efca071ca22fc86a]::query::erase::Erased<[u8; 0usize]>>
  38:     0x7fcc6cfcada1 - <rustc_query_impl[482b33e8cb77ad03]::query_impl::coherent_trait::dynamic_query::{closure#2} as core[bf64e138fa002a57]::ops::function::FnOnce<(rustc_middle[efca071ca22fc86a]::ty::context::TyCtxt, rustc_span[a8290ff303d9da59]::def_id::DefId)>>::call_once
  39:     0x7fcc6d8d9f50 - rustc_query_system[6e0ae15f65f556c9]::query::plumbing::try_execute_query::<rustc_query_impl[482b33e8cb77ad03]::DynamicConfig<rustc_query_system[6e0ae15f65f556c9]::query::caches::DefaultCache<rustc_span[a8290ff303d9da59]::def_id::DefId, rustc_middle[efca071ca22fc86a]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[482b33e8cb77ad03]::plumbing::QueryCtxt, false>
  40:     0x7fcc6d8d9c6e - rustc_query_impl[482b33e8cb77ad03]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7fcc6d223a2f - rustc_hir_analysis[2a47ce24b01765db]::check_crate
  42:     0x7fcc6d21c4ea - rustc_interface[334a3faf735d4cd5]::passes::analysis
  43:     0x7fcc6d8663ba - rustc_query_impl[482b33e8cb77ad03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[482b33e8cb77ad03]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[efca071ca22fc86a]::query::erase::Erased<[u8; 1usize]>>
  44:     0x7fcc6d8663a9 - <rustc_query_impl[482b33e8cb77ad03]::query_impl::analysis::dynamic_query::{closure#2} as core[bf64e138fa002a57]::ops::function::FnOnce<(rustc_middle[efca071ca22fc86a]::ty::context::TyCtxt, ())>>::call_once
  45:     0x7fcc6d9f7878 - rustc_query_system[6e0ae15f65f556c9]::query::plumbing::try_execute_query::<rustc_query_impl[482b33e8cb77ad03]::DynamicConfig<rustc_query_system[6e0ae15f65f556c9]::query::caches::SingleCache<rustc_middle[efca071ca22fc86a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[482b33e8cb77ad03]::plumbing::QueryCtxt, false>
  46:     0x7fcc6d9f75f9 - rustc_query_impl[482b33e8cb77ad03]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7fcc6d622c96 - <rustc_middle[efca071ca22fc86a]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[7bf055920e34ea09]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>>
  48:     0x7fcc6d62211c - <rustc_interface[334a3faf735d4cd5]::interface::Compiler>::enter::<rustc_driver_impl[7bf055920e34ea09]::run_compiler::{closure#1}::{closure#2}, core[bf64e138fa002a57]::result::Result<core[bf64e138fa002a57]::option::Option<rustc_interface[334a3faf735d4cd5]::queries::Linker>, rustc_span[a8290ff303d9da59]::ErrorGuaranteed>>
  49:     0x7fcc6d61f438 - std[aea77ae81c04368]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[334a3faf735d4cd5]::util::run_in_thread_pool_with_globals<rustc_interface[334a3faf735d4cd5]::interface::run_compiler<core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>, rustc_driver_impl[7bf055920e34ea09]::run_compiler::{closure#1}>::{closure#0}, core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>>
  50:     0x7fcc6dbc6f65 - <<std[aea77ae81c04368]::thread::Builder>::spawn_unchecked_<rustc_interface[334a3faf735d4cd5]::util::run_in_thread_pool_with_globals<rustc_interface[334a3faf735d4cd5]::interface::run_compiler<core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>, rustc_driver_impl[7bf055920e34ea09]::run_compiler::{closure#1}>::{closure#0}, core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bf64e138fa002a57]::result::Result<(), rustc_span[a8290ff303d9da59]::ErrorGuaranteed>>::{closure#1} as core[bf64e138fa002a57]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7fcc6b171195 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h045ef323e16ec814
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/alloc/src/boxed.rs:2007:9
  52:     0x7fcc6b171195 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he86ace8451cc8e6e
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/alloc/src/boxed.rs:2007:9
  53:     0x7fcc6b171195 - std::sys::unix::thread::Thread::new::thread_start::h7e69879faf381c5e
                               at /rustc/8550f15e148407159af401e02b1d9259762b3496/library/std/src/sys/unix/thread.rs:108:17
  54:     0x7fcc6ae8c9eb - <unknown>
  55:     0x7fcc6af10ebc - <unknown>
  56:                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: please attach the file at `/tmp/P/icemaker_reduced/rustc-ice-2023-08-29T16:18:38.467779033Z-477833.txt` to your bug report

note: compiler flags: -Z trait-solver=next-coherence --crate-type lib

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `core::cmp::Eq`
#1 [coherent_trait] coherence checking all impls of trait `core::cmp::Eq`
#2 [analysis] running analysis passes on this crate
end of query stack

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) requires-incomplete-features This issue requires the use of incomplete features. labels Aug 29, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 29, 2023
@lqd
Copy link
Member

lqd commented Aug 29, 2023

The repro code is missing a final } to actually trigger the ICE.

@matthiaskrgr
Copy link
Member Author

ah oops, thanks. fixed!

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 30, 2023
@bors bors closed this as completed in 36182f1 Aug 30, 2023
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) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants