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: Closure in inline const block causes an error. #90013

Closed
lilasta opened this issue Oct 18, 2021 · 0 comments · Fixed by #90028
Closed

ICE: Closure in inline const block causes an error. #90013

lilasta opened this issue Oct 18, 2021 · 0 comments · Fixed by #90028
Labels
C-bug Category: This is a bug. F-inline_const Inline constants (aka: const blocks, const expressions, anonymous constants) 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

@lilasta
Copy link
Contributor

lilasta commented Oct 18, 2021

Code

Playground

#![feature(inline_const)]

fn main() {
    const { || {} };
}

Meta

rustc --version --verbose:

rustc 1.58.0-nightly (1f12ac872 2021-10-17)
binary: rustc
commit-hash: 1f12ac87296ac61ec002e0243e7ad5a50364da35
commit-date: 2021-10-17
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler/rustc_trait_selection/src/traits/structural_match.rs:201:17: unexpected type during structural-match checking: [[email protected]:4:13: 4:18]

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1146: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.58.0-nightly (1f12ac872 2021-10-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_const_qualif] const checking `main::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
end of query stack
Backtrace

stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_trait_selection::traits::structural_match::Search as rustc_middle::ty::fold::TypeVisitor>::visit_ty
   8: rustc_infer::infer::InferCtxtBuilder::enter
   9: rustc_trait_selection::traits::structural_match::search_for_structural_match_violation
  10: <rustc_const_eval::transform::check_consts::qualifs::CustomEq as rustc_const_eval::transform::check_consts::qualifs::Qualif>::in_any_value_of_ty
  11: rustc_const_eval::transform::check_consts::check::Checker::qualifs_in_return_place
  12: rustc_mir_transform::mir_const_qualif
  13: core::ops::function::FnOnce::call_once
  14: rustc_query_system::query::plumbing::try_execute_query
  15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const_qualif
  16: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
  17: rustc_query_system::query::plumbing::get_query
  18: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
  19: rustc_const_eval::const_eval::eval_queries::eval_to_const_value_raw_provider
  20: rustc_query_system::query::plumbing::get_query
  21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  22: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  23: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  24: rustc_infer::infer::InferCtxt::const_eval_resolve
  25: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
  26: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
  27: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  28: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_with_constness_where_possible
  29: rustc_typeck::check::fallback::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::type_inference_fallback
  30: rustc_infer::infer::InferCtxtBuilder::enter
  31: rustc_typeck::check::typeck
  32: rustc_query_system::query::plumbing::try_execute_query
  33: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  34: rustc_data_structures::sync::par_for_each_in
  35: rustc_typeck::check::typeck_item_bodies
  36: rustc_query_system::query::plumbing::try_execute_query
  37: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  38: rustc_session::utils::<impl rustc_session::session::Session>::time
  39: rustc_typeck::check_crate
  40: rustc_interface::passes::analysis
  41: rustc_query_system::query::plumbing::try_execute_query
  42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  43: rustc_interface::passes::QueryContext::enter
  44: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  45: rustc_span::with_source_map
  46: scoped_tls::ScopedKey<T>::set

@lilasta lilasta 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 Oct 18, 2021
@JohnTitor JohnTitor added the F-inline_const Inline constants (aka: const blocks, const expressions, anonymous constants) label Oct 18, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 20, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Oct 21, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Oct 21, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Oct 22, 2021
@bors bors closed this as completed in 9ed9025 Oct 22, 2021
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. F-inline_const Inline constants (aka: const blocks, const expressions, anonymous constants) 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.

2 participants