Skip to content

ICE: expected ConstKind::Param here, found Const { ty: f64, kind: Error(ErrorGuaranteed(())) }: not fully fixed #104390

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Rageking8 opened this issue Nov 14, 2022 · 4 comments · Fixed by #104444
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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

@Rageking8
Copy link
Contributor

Rageking8 commented Nov 14, 2022

Codes that reproduce the ICE (found using custom DIY fuzzer)

fn f() -> impl Sized { & 2E }
fn main() {}
fn f() -> impl Sized { && 2E }
fn main() {}
fn f() -> impl Sized { &'a 2E }
fn main() {}
fn f() -> impl Sized { &'static 2E }
fn main() {}
fn f() -> impl Sized { *& 2E }
fn main() {}
fn f() -> impl Sized { &'_ 2E }
fn main() {}

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (e631891f7 2022-11-13)
binary: rustc
commit-hash: e631891f7ad40eac3ef58ec3c2b57ecd81e40615
commit-date: 2022-11-13
host: x86_64-pc-windows-msvc
release: 1.67.0-nightly
LLVM version: 15.0.4

Sample error output

error: expected at least one digit in exponent
 --> src\main.rs:1:26
  |
1 | fn f() -> impl Sized { & 2E }
  |                          ^^
Sample Backtrace

error: internal compiler error: compiler\rustc_const_eval\src\transform\check_consts\qualifs.rs:355:32: expected ConstKind::Param here, found Const { ty: f64, kind: Error(ErrorGuaranteed(())) }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615\compiler\rustc_errors\src\lib.rs:1551:9
stack backtrace:
   0:     0x7ffcbccc9a72 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8461253d72bb7f66
   1:     0x7ffcbcd05aeb - core::fmt::write::h1f6457170e7bab5f
   2:     0x7ffcbccbc4da - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h0eb90b1078016b04
   3:     0x7ffcbccc97bb - std::sys::common::alloc::realloc_fallback::hdd8f739402e5ca67
   4:     0x7ffcbcccd0e9 - std::panicking::default_hook::h7c974d3bb0475c0c
   5:     0x7ffcbccccd6a - std::panicking::default_hook::h7c974d3bb0475c0c
   6:     0x7ffca9172bdb - rustc_driver[8125f59cac749731]::describe_lints
   7:     0x7ffcbcccda40 - std::panicking::rust_panic_with_hook::h80416c3fb7a5a375
   8:     0x7ffcab484c03 - <rustc_middle[ba6a056fa51202ca]::ty::rvalue_scopes::RvalueScopes as core[cb643aa3b6b12595]::fmt::Debug>::fmt
   9:     0x7ffcab482299 - <rustc_middle[ba6a056fa51202ca]::ty::rvalue_scopes::RvalueScopes as core[cb643aa3b6b12595]::fmt::Debug>::fmt
  10:     0x7ffcab4368d9 - <&rustc_middle[ba6a056fa51202ca]::ty::list::List<rustc_middle[ba6a056fa51202ca]::ty::subst::GenericArg> as rustc_middle[ba6a056fa51202ca]::ty::context::Lift>::lift_to_tcx
  11:     0x7ffcab4368c9 - <&rustc_middle[ba6a056fa51202ca]::ty::list::List<rustc_middle[ba6a056fa51202ca]::ty::subst::GenericArg> as rustc_middle[ba6a056fa51202ca]::ty::context::Lift>::lift_to_tcx
  12:     0x7ffcab4355e0 - <&rustc_middle[ba6a056fa51202ca]::ty::list::List<rustc_middle[ba6a056fa51202ca]::ty::subst::GenericArg> as rustc_middle[ba6a056fa51202ca]::ty::context::Lift>::lift_to_tcx
  13:     0x7ffcab4350d2 - <&rustc_middle[ba6a056fa51202ca]::ty::list::List<rustc_middle[ba6a056fa51202ca]::ty::subst::GenericArg> as rustc_middle[ba6a056fa51202ca]::ty::context::Lift>::lift_to_tcx
  14:     0x7ffcab42e357 - <&rustc_middle[ba6a056fa51202ca]::ty::list::List<rustc_middle[ba6a056fa51202ca]::ty::Ty> as rustc_middle[ba6a056fa51202ca]::ty::context::Lift>::lift_to_tcx
  15:     0x7ffcab42e4e8 - rustc_middle[ba6a056fa51202ca]::util::bug::bug_fmt
  16:     0x7ffcab42e465 - rustc_middle[ba6a056fa51202ca]::util::bug::bug_fmt
  17:     0x7ffca8a11acf - <rustc_const_eval[6f5abca75124bc59]::transform::check_consts::qualifs::CustomEq as rustc_const_eval[6f5abca75124bc59]::transform::check_consts::qualifs::Qualif>::in_any_value_of_ty
  18:     0x7ffca89eca27 - rustc_const_eval[6f5abca75124bc59]::const_eval::eval_queries::eval_to_allocation_raw_provider
  19:     0x7ffca8a0092b - <rustc_const_eval[6f5abca75124bc59]::transform::promote_consts::PromoteTemps as rustc_middle[ba6a056fa51202ca]::mir::MirPass>::run_pass
  20:     0x7ffca8508b19 - <rustc_mir_transform[1ce5552845ca28f8]::simplify::UsedLocals as rustc_middle[ba6a056fa51202ca]::mir::visit::Visitor>::visit_statement
  21:     0x7ffca7385672 - <rustc_const_eval[6f5abca75124bc59]::transform::check_consts::resolver::State as core[cb643aa3b6b12595]::clone::Clone>::clone_from
  22:     0x7ffca73ff32d - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  23:     0x7ffca8b34860 - <rustc_span[4f1f30e4e7ab5eca]::def_id::DefId as rustc_serialize[14de8ce5e9575a25]::serialize::Encodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheEncoder>>::encode
  24:     0x7ffca8a5e030 - <rustc_query_impl[957941462a4e4b76]::Queries as rustc_middle[ba6a056fa51202ca]::ty::query::QueryEngine>::as_any
  25:     0x7ffca87d1491 - <rustc_mir_build[34df0801c3a8c92]::build::expr::as_place::PlaceBuilder as core[cb643aa3b6b12595]::convert::From<rustc_middle[ba6a056fa51202ca]::mir::Local>>::from
  26:     0x7ffca87d0e78 - <rustc_mir_build[34df0801c3a8c92]::build::expr::as_place::PlaceBuilder as core[cb643aa3b6b12595]::convert::From<rustc_middle[ba6a056fa51202ca]::mir::Local>>::from
  27:     0x7ffca7386d18 - <rustc_const_eval[6f5abca75124bc59]::transform::check_consts::resolver::State as core[cb643aa3b6b12595]::clone::Clone>::clone_from
  28:     0x7ffca7408725 - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  29:     0x7ffca8b4269c - <rustc_span[4f1f30e4e7ab5eca]::def_id::DefId as rustc_serialize[14de8ce5e9575a25]::serialize::Encodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheEncoder>>::encode
  30:     0x7ffca8a5fcb5 - <rustc_query_impl[957941462a4e4b76]::Queries as rustc_middle[ba6a056fa51202ca]::ty::query::QueryEngine>::as_any
  31:     0x7ffca8445208 - <dyn rustc_hir_analysis[ef55755694313895]::astconv::AstConv>::ty_of_fn
  32:     0x7ffca8b04c02 - <rustc_span[4f1f30e4e7ab5eca]::def_id::DefId as rustc_serialize[14de8ce5e9575a25]::serialize::Encodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheEncoder>>::encode
  33:     0x7ffca8bc2ce0 - <rustc_span[4f1f30e4e7ab5eca]::def_id::DefId as rustc_serialize[14de8ce5e9575a25]::serialize::Encodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheEncoder>>::encode
  34:     0x7ffca7109903 - rustc_hir_analysis[ef55755694313895]::check::provide
  35:     0x7ffca847176a - rustc_hir_analysis[ef55755694313895]::check::check::check_abi
  36:     0x7ffca7385c18 - <rustc_const_eval[6f5abca75124bc59]::transform::check_consts::resolver::State as core[cb643aa3b6b12595]::clone::Clone>::clone_from
  37:     0x7ffca740ac85 - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  38:     0x7ffca8b47658 - <rustc_span[4f1f30e4e7ab5eca]::def_id::DefId as rustc_serialize[14de8ce5e9575a25]::serialize::Encodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheEncoder>>::encode
  39:     0x7ffca75498ec - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  40:     0x7ffca70dfc8c - <<dyn rustc_hir_analysis[ef55755694313895]::astconv::AstConv>::create_substs_for_ast_path::{closure#0}::SubstsForAstPathCtxt as rustc_hir_analysis[ef55755694313895]::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
  41:     0x7ffca70d7618 - rustc_hir_analysis[ef55755694313895]::check_crate
  42:     0x7ffca69b9105 - rustc_interface[a7155063fa577084]::passes::analysis
  43:     0x7ffca73885be - <rustc_const_eval[6f5abca75124bc59]::transform::check_consts::resolver::State as core[cb643aa3b6b12595]::clone::Clone>::clone_from
  44:     0x7ffca7428f19 - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  45:     0x7ffca750074e - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  46:     0x7ffca7550336 - <&rustc_index[c071b730a019c59f]::vec::IndexVec<rustc_middle[ba6a056fa51202ca]::mir::Promoted, rustc_middle[ba6a056fa51202ca]::mir::Body> as rustc_serialize[14de8ce5e9575a25]::serialize::Decodable<rustc_query_impl[957941462a4e4b76]::on_disk_cache::CacheDecoder>>::decode
  47:     0x7ffca696bd54 - <unknown>
  48:     0x7ffca697bf98 - rustc_driver[8125f59cac749731]::args::arg_expand_all
  49:     0x7ffca6997c2a - <rustc_middle[ba6a056fa51202ca]::ty::SymbolName as core[cb643aa3b6b12595]::fmt::Debug>::fmt
  50:     0x7ffca697b3cd - rustc_driver[8125f59cac749731]::args::arg_expand_all
  51:     0x7ffca696c819 - <unknown>
  52:     0x7ffca69639b0 - <unknown>
  53:     0x7ffcbccdfaec - std::sys::windows::thread::Thread::new::hdfa7fc2667a94846
  54:     0x7ffd9f2554e0 - BaseThreadInitThunk
  55:     0x7ffda0be485b - RtlUserThreadStart

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.67.0-nightly (e631891f7 2022-11-13) running on x86_64-pc-windows-msvc

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

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

query stack during panic:
#0 [mir_promoted] processing MIR for `f`
#1 [mir_borrowck] borrow-checking `f`
#2 [type_of] computing type of `f::{opaque#0}`
#3 [check_mod_item_types] checking item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `tmpice` due to previous error

The original code (#104209) is already fixed by #104233, however some other mutations of the original code still ICEs with the same backtrace and error. Thanks.


CC @compiler-errors @jruderman

@Rageking8 Rageking8 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 Nov 14, 2022
@compiler-errors compiler-errors added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Nov 14, 2022
@compiler-errors
Copy link
Member

If the parsing error -> impl { is not needed to manifest the issue, can that be fixed (-> impl Sized {) in the MCVE you provided? since more error messages just obscures the underlying ICE that needs to be fixed here.

@compiler-errors
Copy link
Member

(also this could probably use a more descriptive title that reflects the ICE, and doesn't just point to another issue, but that's just my opinion)

@Rageking8
Copy link
Contributor Author

@compiler-errors Is that better?

@Rageking8 Rageking8 changed the title Issue 104209 not fully fixed ICE: expected ConstKind::Param here, found Const { ty: f64, kind: Error(ErrorGuaranteed(())): not fully fixed Nov 14, 2022
@Rageking8 Rageking8 changed the title ICE: expected ConstKind::Param here, found Const { ty: f64, kind: Error(ErrorGuaranteed(())): not fully fixed ICE: expected ConstKind::Param here, found Const { ty: f64, kind: Error(ErrorGuaranteed(())) }: not fully fixed Nov 14, 2022
@chenyukang
Copy link
Member

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 17, 2022
…mpiler-errors

Fix ICE in in_operand for ty error

Fixes rust-lang#104390

By the way, moving some test cases to proper directory for tidy bless.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 17, 2022
…mpiler-errors

Fix ICE in in_operand for ty error

Fixes rust-lang#104390

By the way, moving some test cases to proper directory for tidy bless.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 17, 2022
…mpiler-errors

Fix ICE in in_operand for ty error

Fixes rust-lang#104390

By the way, moving some test cases to proper directory for tidy bless.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 17, 2022
…mpiler-errors

Fix ICE in in_operand for ty error

Fixes rust-lang#104390

By the way, moving some test cases to proper directory for tidy bless.
@bors bors closed this as completed in 20ea083 Nov 18, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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

Successfully merging a pull request may close this issue.

3 participants