Skip to content

Closure in array length ICE's #68542

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
DutchGhost opened this issue Jan 25, 2020 · 0 comments · Fixed by #68563
Closed

Closure in array length ICE's #68542

DutchGhost opened this issue Jan 25, 2020 · 0 comments · Fixed by #68563
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

DutchGhost commented Jan 25, 2020

The following ICE's in beta and nightly:

struct Bug {
    a: [(); (|| { 0 })()]
}
Backtrace:

Compiling playground v0.0.1 (/playground)
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
 --> src/lib.rs:2:13
  |
2 |     a: [(); (|| { 0 })()]
  |             ^^^^^^^^^^^^

error: internal compiler error: src/librustc_typeck/collect.rs:1969: to get the signature of a closure, use `closure_sig()` not `fn_sig()`

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:882:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::bug_fmt
  20: rustc_typeck::collect::fn_sig
  21: rustc::ty::query::__query_compute::fn_sig
  22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  23: rustc_mir::const_eval::fn_queries::provide::is_const_fn_raw
  24: rustc::ty::query::__query_compute::is_const_fn_raw
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  26: <rustc_mir::const_eval::machine::CompileTimeInterpreter as rustc_mir::interpret::machine::Machine>::find_mir_or_eval_fn
  27: rustc_mir::interpret::terminator::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_fn_call
  28: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::step
  29: rustc_mir::const_eval::eval_queries::const_eval_raw_provider
  30: rustc::ty::query::__query_compute::const_eval_raw
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  33: rustc::ty::query::__query_compute::const_eval_validated
  34: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  35: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  36: rustc::ty::query::__query_compute::const_eval_validated
  37: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval_validated>::compute
  38: rustc::dep_graph::graph::DepGraph::with_task_impl
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  40: rustc::mir::interpret::queries::<impl rustc::ty::context::TyCtxt>::const_eval_instance
  41: rustc::mir::interpret::queries::<impl rustc::ty::context::TyCtxt>::const_eval_resolve
  42: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_const
  43: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable for &rustc::ty::TyS>::super_fold_with
  44: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
  45: rustc::traits::project::normalize
  46: rustc_typeck::check::FnCtxt::normalize_associated_types_in
  47: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  48: rustc::ty::context::GlobalCtxt::enter_local
  49: rustc_typeck::check::wfcheck::check_item_well_formed
  50: rustc::ty::query::__query_compute::check_item_well_formed
  51: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::check_item_well_formed>::compute
  52: rustc::dep_graph::graph::DepGraph::with_task_impl
  53: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  54: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  55: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  56: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  57: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  58: rustc_hir::hir::Crate::par_visit_all_item_likes
  59: rustc_typeck::check_crate
  60: rustc_interface::passes::analysis
  61: rustc::ty::query::__query_compute::analysis
  62: rustc::dep_graph::graph::DepGraph::with_task_impl
  63: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  64: rustc::ty::context::tls::enter_global
  65: rustc_interface::interface::run_compiler_in_existing_thread_pool
  66: scoped_tls::ScopedKey<T>::set
  67: syntax::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (c2d141df5 2020-01-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C codegen-units=1 --crate-type lib

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

query stack during panic:
#0 [fn_sig] processing `Bug::a::{{constant}}#0::{{closure}}#0`
#1 [is_const_fn_raw] checking if item is const fn: `Bug::a::{{constant}}#0::{{closure}}#0`
#2 [const_eval_raw] const-evaluating `Bug::a::{{constant}}#0`
#3 [const_eval_validated] const-evaluating + checking `Bug::a::{{constant}}#0`
#4 [const_eval_validated] const-evaluating + checking `Bug::a::{{constant}}#0`
#5 [check_item_well_formed] processing `Bug`
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0015`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 25, 2020
@DutchGhost DutchGhost changed the title Async in array length ICE's Closure in array length ICE's Jan 25, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jan 26, 2020
@pietroalbini pietroalbini added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Jan 27, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jan 28, 2020
@bors bors closed this as completed in 9ad1a8c Jan 28, 2020
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. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

4 participants