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: compiler/rustc_typeck/src/check/callee.rs:591:17: failed to find an overloaded call trait for closure call #86238

Closed
Cancelll opened this issue Jun 12, 2021 · 1 comment · Fixed by #86249
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Cancelll
Copy link

Code

#![no_core]
fn main() {
    let one = || {};
    one()
}
#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (0a8629bff 2021-06-11)
binary: rustc
commit-hash: 0a8629bff642c3c3b84bb644c0099194f063b627
commit-date: 2021-06-11
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error[E0658]: language items are subject to change
 --> mutant.rs:6:1
  |
6 | #[lang = "sized"]
  | ^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

error[E0658]: language items are subject to change
 --> mutant.rs:8:1
  |
8 | #[lang = "copy"]
  | ^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

error[E0658]: the `#[no_core]` attribute is an experimental feature
 --> mutant.rs:1:1
  |
1 | #![no_core]
  | ^^^^^^^^^^^
  |
  = note: see issue #29639 <https://github.com/rust-lang/rust/issues/29639> for more information
  = help: add `#![feature(no_core)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_typeck/src/check/callee.rs:591:17: failed to find an overloaded call trait for closure call
 --> mutant.rs:4:5
  |
4 |     one()
  |     ^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/compiler/rustc_errors/src/lib.rs:953: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.54.0-nightly (0a8629bff 2021-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
Backtrace

error[E0658]: language items are subject to change
 --> mutant.rs:6:1
  |
6 | #[lang = "sized"]
  | ^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

error[E0658]: language items are subject to change
 --> mutant.rs:8:1
  |
8 | #[lang = "copy"]
  | ^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

error[E0658]: the `#[no_core]` attribute is an experimental feature
 --> mutant.rs:1:1
  |
1 | #![no_core]
  | ^^^^^^^^^^^
  |
  = note: see issue #29639 <https://github.com/rust-lang/rust/issues/29639> for more information
  = help: add `#![feature(no_core)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_typeck/src/check/callee.rs:591:17: failed to find an overloaded call trait for closure call
 --> mutant.rs:4:5
  |
4 |     one()
  |     ^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/compiler/rustc_errors/src/lib.rs:953: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: rustc_typeck::check::callee::DeferredCallResolution::resolve
   8: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::analyze_closure
   9: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  10: rustc_hir::intravisit::walk_stmt
  11: rustc_hir::intravisit::walk_expr
  12: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  13: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::closure_analyze
  14: rustc_typeck::check::inherited::InheritedBuilder::enter
  15: rustc_typeck::check::typeck
  16: rustc_query_system::query::plumbing::get_query_impl
  17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  18: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  19: rustc_typeck::check::typeck_item_bodies
  20: rustc_query_system::query::plumbing::get_query_impl
  21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  22: rustc_session::utils::<impl rustc_session::session::Session>::time
  23: rustc_typeck::check_crate
  24: rustc_interface::passes::analysis
  25: rustc_query_system::query::plumbing::get_query_impl
  26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  27: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  28: rustc_span::with_source_map
  29: rustc_interface::interface::create_compiler_and_run
  30: scoped_tls::ScopedKey<T>::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.54.0-nightly (0a8629bff 2021-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.

@Cancelll Cancelll 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 Jun 12, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Jun 18, 2021
JohnTitor pushed a commit to fanninpm/glacier that referenced this issue Jun 21, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 21, 2021
@chengniansun
Copy link

A different, slightly simpler version

#![no_core]
#[lang = "sized"]
trait Sized {}
fn main() {
    match 0 {
        e if (|| e == 0)() => 1,
    }
}

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jul 11, 2021
Report an error if resolution of closure call functions failed

This pull request fixes rust-lang#86238. The current implementation seems to assume that resolution of closure call functions (I'm not sure what the proper term is; I mean `call` of `Fn` etc.) can never fail:
https://github.com/rust-lang/rust/blob/60f1a2fc4b535ead9c85ce085fdce49b1b097531/compiler/rustc_typeck/src/check/callee.rs#L590-L595

But actually, it can, if the `fn`/`fn_mut`/`fn_once` lang items are not defined, or don't have an associated `call`/`call_mut`/`call_once` function, leading to the ICE described in rust-lang#86238. I have therefore turned the `span_bug!()` into an error message, which prevents the ICE.
@bors bors closed this as completed in 54aaca8 Jul 12, 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. glacier ICE tracked in rust-lang/glacier. 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