rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.12k stars 12.79k forks source link

Bugs when trying to infer type of const generic #88891

Open fishrockz opened 3 years ago

fishrockz commented 3 years ago

I tried using #![feature(generic_arg_infer)]

and got the following crashes, if you want me to push up some commits and link them here i can if it would be useful.

Thanks Will

Code

pub struct ICMCommon<InterfaceThing: ?Sized, E> {
    phantom: PhantomData<InterfaceThing>,
    sleep_bit: BitStruct<dyn Interface<Error = InterfaceError<E>>, _,_,_>,
}

later

    pub fn new() -> Result<Self, BitByteStructError<InterfaceError<E>>> {
        let sleep_bit = BitStruct::<dyn Interface<Error = InterfaceError<E>>, ICM20X_B0_PWR_MGMT_1, 1, 6>::new()?
   }

gives

  Compiling icm20948 v0.1.0 (/home/will/projects/rust/embedded/bluepill/icm20948-rs)
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:560:17: expected const for `ADDRESS/#1` (Const { ty: u8, val: Param(ADDRESS/#1) }/1) but found Type([type error]) when substituting substs=[(dyn bit_byte_structs::bus::Interface<Error = bit_byte_structs::bus::InterfaceError<E>> + 'static), [type error], [type error], [type error]]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/8c2b6ea37d7719a0370bd404030eef9702c1752c/compiler/rustc_errors/src/lib.rs:1092:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.57.0-nightly (8c2b6ea37 2021-09-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [type_of] computing type of `ICMCommon::sleep_bit`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
end of query stack
error: could not compile `icm20948`

and

pub struct ICMCommon<InterfaceThing: ?Sized, E> {
    phantom: PhantomData<InterfaceThing>,
    sleep_bit: BitStruct<dyn Interface<Error = InterfaceError<E>>, ICM20X_B0_PWR_MGMT_1, 1, 6_,_,_>,
}

later

    pub fn new() -> Result<Self, BitByteStructError<InterfaceError<E>>> {
        let sleep_bit = BitStruct::<dyn Interface<Error = InterfaceError<E>>, _,_,_>::new()?
   }

gives

   Compiling icm20948 v0.1.0 (/home/will/projects/rust/embedded/bluepill/icm20948-rs)
thread 'rustc' panicked at 'not yet implemented', compiler/rustc_typeck/src/astconv/mod.rs:462:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.57.0-nightly (8c2b6ea37 2021-09-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [typeck] type-checking `<impl at src/lib.rs:221:1: 542:2>::new`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: could not compile `icm20948`

Meta

rustc --version --verbose:

will@localhost icm20948-rs]$ rustc --version --verbose
rustc 1.57.0-nightly (8c2b6ea37 2021-09-11)
binary: rustc
commit-hash: 8c2b6ea37d7719a0370bd404030eef9702c1752c
commit-date: 2021-09-11
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

Error output

<output>
Backtrace

``` [will@localhost icm20948-rs]$ RUST_BACKTRACE=1 cargo build --target=x86_64-unknown-linux-gnu Compiling icm20948 v0.1.0 (/home/will/projects/rust/embedded/bluepill/icm20948-rs) error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:560:17: expected const for `ADDRESS/#1` (Const { ty: u8, val: Param(ADDRESS/#1) }/1) but found Type([type error]) when substituting substs=[(dyn bit_byte_structs::bus::Interface> + 'static), [type error], [type error], [type error]] thread 'rustc' panicked at 'Box', /rustc/8c2b6ea37d7719a0370bd404030eef9702c1752c/compiler/rustc_errors/src/lib.rs:1092:9 stack backtrace: 0: std::panicking::begin_panic 1: std::panic::panic_any 2: rustc_errors::HandlerInner::span_bug 3: rustc_errors::Handler::span_bug 4: rustc_middle::ty::context::tls::with_opt 5: rustc_middle::util::bug::opt_span_bug_fmt 6: rustc_middle::util::bug::span_bug_fmt 7: ::fold_const 8: as core::iter::traits::collect::Extend<::Item>>::extend 9: rustc_middle::ty::fold::TypeFoldable::fold_with 10: rustc_middle::ty::structural_impls::::super_fold_with 11: ::ast_path_to_ty 12: ::ast_ty_to_ty_inner 13: rustc_typeck::collect::type_of::type_of 14: rustc_query_system::dep_graph::graph::DepGraph::with_task 15: rustc_data_structures::stack::ensure_sufficient_stack 16: rustc_query_system::query::plumbing::try_execute_query 17: ::type_of 18: ::visit_item 19: rustc_typeck::outlives::inferred_outlives_crate 20: rustc_middle::dep_graph::::with_deps 21: rustc_query_system::dep_graph::graph::DepGraph::with_task 22: rustc_data_structures::stack::ensure_sufficient_stack 23: rustc_query_system::query::plumbing::try_execute_query 24: ::inferred_outlives_crate 25: rustc_typeck::outlives::inferred_outlives_of 26: rustc_query_system::dep_graph::graph::DepGraph::with_task 27: rustc_data_structures::stack::ensure_sufficient_stack 28: rustc_query_system::query::plumbing::try_execute_query 29: ::inferred_outlives_of 30: rustc_typeck::collect::predicates_defined_on 31: rustc_query_system::dep_graph::graph::DepGraph::with_task 32: rustc_data_structures::stack::ensure_sufficient_stack 33: rustc_query_system::query::plumbing::try_execute_query 34: ::predicates_defined_on 35: rustc_typeck::collect::predicates_of 36: rustc_query_system::dep_graph::graph::DepGraph::with_task 37: rustc_data_structures::stack::ensure_sufficient_stack 38: rustc_query_system::query::plumbing::try_execute_query 39: ::predicates_of 40: rustc_typeck::collect::convert_item 41: ::visit_item 42: rustc_middle::hir::map::Map::visit_item_likes_in_module 43: rustc_typeck::collect::collect_mod_item_types 44: rustc_query_system::dep_graph::graph::DepGraph::with_task 45: rustc_data_structures::stack::ensure_sufficient_stack 46: rustc_query_system::query::plumbing::try_execute_query 47: ::collect_mod_item_types 48: rustc_session::session::Session::track_errors 49: rustc_typeck::check_crate 50: rustc_interface::passes::analysis 51: rustc_query_system::dep_graph::graph::DepGraph::with_task 52: rustc_data_structures::stack::ensure_sufficient_stack 53: rustc_query_system::query::plumbing::try_execute_query 54: ::analysis 55: rustc_interface::passes::QueryContext::enter 56: rustc_interface::queries::::enter 57: rustc_span::with_source_map 58: scoped_tls::ScopedKey::set note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. 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.57.0-nightly (8c2b6ea37 2021-09-11) running on x86_64-unknown-linux-gnu note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [type_of] computing type of `ICMCommon::sleep_bit` #1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate #2 [inferred_outlives_of] computing inferred outlives predicates of `AccelRangeOptions` #3 [predicates_defined_on] computing predicates of `AccelRangeOptions` #4 [predicates_of] computing predicates of `AccelRangeOptions` #5 [collect_mod_item_types] collecting item types in top-level module #6 [analysis] running analysis passes on this crate end of query stack error: could not compile `icm20948` ```

hellow554 commented 3 years ago

Could you give us the full source code but at least Bitstruct and it's new function along with all needed types (InterfaceThing, Interface, InterfaceError, ICM20X_B0_PWR_MGMT_1) :)

fishrockz commented 3 years ago

This seems to reproduce nicely.

https://gitlab.com/pointswaves/icm20948-rs/-/tree/rustissue-88891

This is the line that i want to infer the type with:

https://gitlab.com/pointswaves/icm20948-rs/-/blob/rustissue-88891/src/lib.rs#L230

Several of the following lines need ether there type adding explicitly or adding _, _, _ but even so, rustc shouldn't crash like this?

If you do set everything explicitly then the code dose works, https://gitlab.com/pointswaves/icm20948-rs/-/commit/a52c8253a7a63775d3c772f8972725bc562e8139#b24749917179fb5e3e613ed2a703fcdcc6cdf9da_237_231

str4d commented 2 years ago

I also just encountered what I believe to be this issue (same ICE location). I've encountered two separate bugs):

❯ cargo fix --edition
    Checking regex v1.5.5
    Checking num-traits v0.2.14
   Compiling gumdrop_derive v0.8.1
    Checking thiserror v1.0.30
    Checking halo2_gadgets v0.1.0-beta.3 (/home/str4d/dev/rust/zcash/halo2/halo2_gadgets)
    Checking halo2 v0.1.0-beta.2 (/home/str4d/dev/rust/zcash/halo2/halo2)
   Migrating halo2_gadgets/src/lib.rs from 2018 edition to 2021
   Migrating halo2/src/lib.rs from 2018 edition to 2021
    Checking plotters v0.3.1
    Checking proptest v1.0.0
    Checking criterion v0.3.5
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:560:17: expected const for `K/#1` (Const { ty: usize, val: Param(K/#1) }/1) but found Type(std::alloc::Global) when substituting substs=[sinsemilla::message::MessagePiece<F, K>, std::alloc::Global]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/compiler/rustc_errors/src/lib.rs:1093:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.56.1 (59eed8a2a 2021-11-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [adt_significant_drop_tys] computing when `sinsemilla::message::Message` has a significant destructor
#1 [has_significant_drop_raw] computing whether `sinsemilla::message::Message<pasta_curves::Fp, 10_usize, 253_usize>` has a significant drop
end of query stack
error: could not compile `halo2_gadgets`
warning: build failed, waiting for other jobs to finish...
error: build failed
❯ cargo fix --edition
[snip]
    Checking halo2_proofs v0.1.0-beta.4 (/home/str4d/dev/rust/zcash/halo2/halo2_proofs)
   Migrating halo2_proofs/src/lib.rs from 2018 edition to 2021
   Compiling gumdrop_derive v0.8.1
   Compiling thiserror-impl v1.0.30
    Checking gumdrop v0.8.1
error: internal compiler error: compiler/rustc_traits/src/normalize_erasing_regions.rs:54:32: could not fully normalize `plonk::lookup::Argument<<plonk::lookup::Argument<<C as pasta_curves::arithmetic::CurveAffine>::ScalarExt> as pasta_curves::arithmetic::CurveAffine>::ScalarExt>`

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1147:9
stack backtrace:
   0:     0x7f128ab6151c - std::backtrace_rs::backtrace::libunwind::trace::h3fea1eb2e0ba2ac9
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f128ab6151c - std::backtrace_rs::backtrace::trace_unsynchronized::h849d83492cbc0d59
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f128ab6151c - std::sys_common::backtrace::_print_fmt::he3179d37290f23d3
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f128ab6151c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h140f6925cad14324
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f128abbf22c - core::fmt::write::h31b9cd1bedd7ea38
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/fmt/mod.rs:1150:17
   5:     0x7f128ab525a5 - std::io::Write::write_fmt::h1fdf66f83f70913e
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/mod.rs:1667:15
   6:     0x7f128ab64a80 - std::sys_common::backtrace::_print::he7ac492cd19c3189
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f128ab64a80 - std::sys_common::backtrace::print::hba20f8920229d8e8
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f128ab64a80 - std::panicking::default_hook::{{closure}}::h714d63979ae18678
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:210:50
   9:     0x7f128ab64637 - std::panicking::default_hook::hf1afb64e69563ca8
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:227:9
  10:     0x7f128b339b01 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h045e68b20488b66e
  11:     0x7f128ab65299 - std::panicking::rust_panic_with_hook::h02231a501e274a13
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:628:17
  12:     0x7f128c374f8b - std::panicking::begin_panic::{{closure}}::h777af1b405e6beed
  13:     0x7f128c374ed6 - std::sys_common::backtrace::__rust_end_short_backtrace::h67a7e7853206400c
  14:     0x7f128c375eff - std::panicking::begin_panic::hd769b9ceefdb14a6
  15:     0x7f128c38534d - std::panic::panic_any::he7034fd861bf1917
  16:     0x7f128c3873ce - rustc_errors::HandlerInner::bug::h07aea37442b50e13
  17:     0x7f128c386bf0 - rustc_errors::Handler::bug::hcc6e735d806ec79e
  18:     0x7f128c21260e - rustc_middle::ty::context::tls::with_opt::h04e01420349e359b
  19:     0x7f128c2129d0 - rustc_middle::util::bug::opt_span_bug_fmt::h4a82ba802d444f24
  20:     0x7f128c212946 - rustc_middle::util::bug::bug_fmt::hcf1fd372902c876e
  21:     0x7f128c9c3d0a - rustc_infer::infer::InferCtxtBuilder::enter::h8a82609332438ccf
  22:     0x7f128c9d04a8 - core::ops::function::FnOnce::call_once::hf98335709d8238cc
  23:     0x7f128d46ddaf - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h996037a55653400a
  24:     0x7f128d507b9a - rustc_data_structures::stack::ensure_sufficient_stack::h09c07f58c17605a7
  25:     0x7f128c9d600e - rustc_query_system::query::plumbing::get_query_impl::h1a6c0649c5ddb30e
  26:     0x7f128ca71aaf - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::normalize_generic_arg_after_erasing_regions::h9a080611e25ef801
  27:     0x7f128cd8e20b - rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder::normalize_generic_arg_after_erasing_regions::h4a5e623a5f9ea400
  28:     0x7f128cd8e476 - <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty::h225ddd65985624e6
  29:     0x7f128b60bdd2 - <rustc_ty_utils::needs_drop::NeedsDropTypes<F> as core::iter::traits::iterator::Iterator>::next::h7087826c0e8380b2
  30:     0x7f128b602eba - <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next::hd098c85d4190d5ab
  31:     0x7f128b60775c - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h80bc373cacd14a1e
  32:     0x7f128b603506 - core::iter::adapters::process_results::h22c2b36db2b59a59
  33:     0x7f128b60c4b5 - rustc_ty_utils::needs_drop::adt_significant_drop_tys::h5c72b56396dba9f5
  34:     0x7f128d47cffd - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::heb71a11daa2d363b
  35:     0x7f128d51c9da - rustc_data_structures::stack::ensure_sufficient_stack::hb11b8554afb5d568
  36:     0x7f128d3a5ca0 - rustc_query_system::query::plumbing::force_query_with_job::h98c5b82a6efe1896
  37:     0x7f128d34be94 - rustc_query_system::query::plumbing::get_query_impl::h190c6fd7bd23a572
  38:     0x7f128bb7818c - rustc_query_system::query::plumbing::get_query::h3fba9f7d1804ce48
  39:     0x7f128b60af4d - rustc_ty_utils::needs_drop::has_significant_drop_raw::hd7f1b4b110235212
  40:     0x7f128ca5138f - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hfef521bc64664170
  41:     0x7f128ca9d61a - rustc_data_structures::stack::ensure_sufficient_stack::hade48fba7b3bb2bb
  42:     0x7f128c9efcb4 - rustc_query_system::query::plumbing::get_query_impl::h96bce355c1983d62
  43:     0x7f128bb7922f - rustc_query_system::query::plumbing::get_query::hf1549911cb874bfc
  44:     0x7f128b51f8ee - rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::has_significant_drop::h73b4c825c4ccb993
  45:     0x7f128d082c28 - rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::analyze_closure::h209d1f3aff7b0595
  46:     0x7f128c594879 - rustc_hir::intravisit::walk_expr::hc2c05fe08769e282
  47:     0x7f128c5931dd - rustc_hir::intravisit::walk_expr::hc2c05fe08769e282
  48:     0x7f128c64c914 - <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr::h6410406813120c58
  49:     0x7f128c596169 - rustc_hir::intravisit::walk_expr::hc2c05fe08769e282
  50:     0x7f128c64c914 - <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr::h6410406813120c58
  51:     0x7f128c579bca - rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::closure_analyze::he38f50bb079f1258
  52:     0x7f128c5f692d - rustc_infer::infer::InferCtxtBuilder::enter::h5192e9567560c6af
  53:     0x7f128c59d9b4 - rustc_typeck::check::typeck::ha7bb30975bb47ca6
  54:     0x7f128d47458a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hb4aaab7d57cb4bf4
  55:     0x7f128d5130aa - rustc_data_structures::stack::ensure_sufficient_stack::h63ae52df0ead7d8f
  56:     0x7f128d3a52f1 - rustc_query_system::query::plumbing::force_query_with_job::h8fbdba5993d908b0
  57:     0x7f128c9de220 - rustc_query_system::query::plumbing::get_query_impl::h4ffc561cbec4e552
  58:     0x7f128ca6fb1b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck::h508dd00c2355268b
  59:     0x7f128c59dcd8 - rustc_typeck::check::typeck::ha7bb30975bb47ca6
  60:     0x7f128d47458a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hb4aaab7d57cb4bf4
  61:     0x7f128d5130aa - rustc_data_structures::stack::ensure_sufficient_stack::h63ae52df0ead7d8f
  62:     0x7f128d3a52f1 - rustc_query_system::query::plumbing::force_query_with_job::h8fbdba5993d908b0
  63:     0x7f128c9de220 - rustc_query_system::query::plumbing::get_query_impl::h4ffc561cbec4e552
  64:     0x7f128ca6fb1b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck::h508dd00c2355268b
  65:     0x7f128c5bea87 - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners::h19a12f38b112685c
  66:     0x7f128d09898c - rustc_typeck::check::typeck_item_bodies::hfd0c71c244038ff3
  67:     0x7f128d46eed0 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h9e6154181a71a0f3
  68:     0x7f128d39aea4 - rustc_query_system::query::plumbing::force_query_with_job::h2ef444aa2eadce7a
  69:     0x7f128d368f04 - rustc_query_system::query::plumbing::get_query_impl::h6a95e4b1154f34f1
  70:     0x7f128d4c6650 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies::hdcd851568e3c0aeb
  71:     0x7f128d0b257f - rustc_session::utils::<impl rustc_session::session::Session>::time::h45748f8a3a0f0350
  72:     0x7f128d0a46b7 - rustc_typeck::check_crate::hb80848c920cf28e8
  73:     0x7f128ce70133 - rustc_interface::passes::analysis::hcd758edec2335b9e
  74:     0x7f128d459a30 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h34003e747609006c
  75:     0x7f128d51cae5 - rustc_data_structures::stack::ensure_sufficient_stack::hb213c0190b92ec18
  76:     0x7f128d3a10ab - rustc_query_system::query::plumbing::force_query_with_job::h648670b229bdc950
  77:     0x7f128d3865b2 - rustc_query_system::query::plumbing::get_query_impl::he088956570c68f6d
  78:     0x7f128d4c43dd - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::hdd4e495c3d55dc4d
  79:     0x7f128ce64bc7 - rustc_interface::passes::QueryContext::enter::h87e76f1930f25935
  80:     0x7f128ce4bca1 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hff7e36ca6c2085f0
  81:     0x7f128ce3902c - rustc_span::with_source_map::he4ccdc3d435ea73b
  82:     0x7f128ce4b5cc - scoped_tls::ScopedKey<T>::set::hf1cc160e90acdba2
  83:     0x7f128ce3a73b - std::sys_common::backtrace::__rust_begin_short_backtrace::h0b3064789b6c03d4
  84:     0x7f128ce37905 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h3907954af9fcbd87
  85:     0x7f128ab718e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf2a5e508372e2387
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/alloc/src/boxed.rs:1636:9
  86:     0x7f128ab718e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h46642f5b75478456
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/alloc/src/boxed.rs:1636:9
  87:     0x7f128ab718e3 - std::sys::unix::thread::Thread::new::thread_start::h1fbdb50adbde1cab
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys/unix/thread.rs:106:17
  88:     0x7f128aaa1609 - start_thread
                               at /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
  89:     0x7f128a9b4163 - clone
  90:                0x0 - <unknown>

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.56.1 (59eed8a2a 2021-11-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `plonk::lookup::Argument<<plonk::lookup::Argument<<C as pasta_curves::arithmetic::CurveAffine>::ScalarExt> as pasta_curves::arithmetic::CurveAffine>::ScalarExt>`
#1 [adt_significant_drop_tys] computing when `plonk::VerifyingKey` has a significant destructor
#2 [has_significant_drop_raw] computing whether `plonk::VerifyingKey<C>` has a significant drop
#3 [typeck] type-checking `plonk::keygen::keygen_pk`
#4 [typeck] type-checking `plonk::keygen::keygen_pk::{closure#0}`
#5 [typeck_item_bodies] type-checking all item bodies
#6 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `halo2_proofs`
warning: build failed, waiting for other jobs to finish...
error: build failed

The relevant code for the second (reproducible) error:

str4d commented 2 years ago

I tried to reproduce my second ICE above against several toolchain versions:

So this issue may have been fixed inadvertently, or is a duplicate of another issue that was explicitly fixed in 1.57.0. I have not tried to reproduce OP's ICE in recent toolchain versions.

istankovic commented 1 year ago

Couldn't reproduce this. @fishrockz is this still relevant?

jieyouxu commented 9 months ago

Ping from triage: @fishrockz is this still an issue?