Skip to content

ICE: Item being checked wasn't a function/closure #79669

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
matthiaskrgr opened this issue Dec 3, 2020 · 8 comments · Fixed by #79675
Closed

ICE: Item being checked wasn't a function/closure #79669

matthiaskrgr opened this issue Dec 3, 2020 · 8 comments · Fixed by #79675
Assignees
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) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Dec 3, 2020

Code

code from ./src/test/ui/feature-gates/feature-gate-abi.rs

trait Tr {
    extern "rust-call" fn fun() {}
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (1f95c91c8 2020-12-03)
binary: rustc
commit-hash: 1f95c91c887acb2d0c49f549a07025178b818d87
commit-date: 2020-12-03
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

error[E0658]: rust-call ABI is subject to change
 --> ./src/test/ui/feature-gates/feature-gate-abi.rs:2:12
  |
2 |     extern "rust-call" fn fun() {}
  |            ^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_typeck/src/check/check.rs:108:25: Item being checked wasn't a function/closure: TraitItem(TraitItem { ident: fun#0, hir_id: HirId { owner: DefId(0:4 ~ feature_gate_abi[317d]::Tr::fun), local_id: 0 }, attrs: [], generics: Generics { params: [], where_clause: WhereClause { predicates: [], span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:32: 2:32 (#0) }, span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:30: 2:30 (#0) }, kind: Fn(FnSig { header: FnHeader { unsafety: Normal, constness: NotConst, asyncness: NotAsync, abi: RustCall }, decl: FnDecl { inputs: [], output: DefaultReturn(./src/test/ui/feature-gates/feature-gate-abi.rs:2:33: 2:33 (#0)), c_variadic: false, implicit_self: None }, span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:5: 2:32 (#0) }, Provided(BodyId { hir_id: HirId { owner: DefId(0:4 ~ feature_gate_abi[317d]::Tr::fun), local_id: 2 } })), span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:5: 2:35 (#0) })

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958: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.50.0-nightly (1f95c91c8 2020-12-03) running on x86_64-unknown-linux-gnu

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

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

error[E0658]: rust-call ABI is subject to change
 --> ./src/test/ui/feature-gates/feature-gate-abi.rs:2:12
  |
2 |     extern "rust-call" fn fun() {}
  |            ^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_typeck/src/check/check.rs:108:25: Item being checked wasn't a function/closure: TraitItem(TraitItem { ident: fun#0, hir_id: HirId { owner: DefId(0:4 ~ feature_gate_abi[317d]::Tr::fun), local_id: 0 }, attrs: [], generics: Generics { params: [], where_clause: WhereClause { predicates: [], span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:32: 2:32 (#0) }, span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:30: 2:30 (#0) }, kind: Fn(FnSig { header: FnHeader { unsafety: Normal, constness: NotConst, asyncness: NotAsync, abi: RustCall }, decl: FnDecl { inputs: [], output: DefaultReturn(./src/test/ui/feature-gates/feature-gate-abi.rs:2:33: 2:33 (#0)), c_variadic: false, implicit_self: None }, span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:5: 2:32 (#0) }, Provided(BodyId { hir_id: HirId { owner: DefId(0:4 ~ feature_gate_abi[317d]::Tr::fun), local_id: 2 } })), span: ./src/test/ui/feature-gates/feature-gate-abi.rs:2:5: 2:35 (#0) })

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0:     0x7f67fb298990 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f67fb298990 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f67fb298990 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f67fb298990 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f67fb30c58c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f67fb28a462 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/io/mod.rs:1519:15
   6:     0x7f67fb29c615 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f67fb29c615 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f67fb29c615 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/panicking.rs:208:50
   9:     0x7f67fb29c16a - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/panicking.rs:225:9
  10:     0x7f67fbb30148 - rustc_driver::report_ice::hff78d76a39ffbb86
  11:     0x7f67fb29cf16 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/panicking.rs:595:17
  12:     0x7f67fec8d58d - std::panicking::begin_panic::{{closure}}::he3ac55d11a883a10
  13:     0x7f67fec8d296 - std::sys_common::backtrace::__rust_end_short_backtrace::h4402bc3ed558879b
  14:     0x7f67fec8d52f - std::panicking::begin_panic::hd2137c659c375844
  15:     0x7f67fecc79dc - rustc_errors::HandlerInner::bug::hbfb11e3c8ba1475f
  16:     0x7f67fecc60f0 - rustc_errors::Handler::bug::ha00f48e1291906a1
  17:     0x7f67fe563e54 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h121c3336b55e047b
  18:     0x7f67fe5629db - rustc_middle::ty::context::tls::with_opt::{{closure}}::h61e852c60289ba39
  19:     0x7f67fe562982 - rustc_middle::ty::context::tls::with_opt::h7523943876fa0859
  20:     0x7f67fe563d73 - rustc_middle::util::bug::opt_span_bug_fmt::h131d336df190dd17
  21:     0x7f67fe563ce5 - rustc_middle::util::bug::bug_fmt::hd70ee7a62354ffb4
  22:     0x7f67fc639944 - rustc_typeck::check::check::check_fn::heb12fddb61eb47fe
  23:     0x7f67fc813c86 - rustc_infer::infer::InferCtxtBuilder::enter::h8f9578ee3213fdbe
  24:     0x7f67fc8900b8 - rustc_typeck::check::typeck::h26b1d4f327e46c94
  25:     0x7f67fc7ab9ae - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute::h50f9fd8d083760a1
  26:     0x7f67fc76cb3b - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h95cf58173480903c
  27:     0x7f67fc77b67b - rustc_data_structures::stack::ensure_sufficient_stack::h0ef6bb96e956214e
  28:     0x7f67fc8ae014 - rustc_query_system::query::plumbing::get_query_impl::h1072b648cee2328c
  29:     0x7f67fc91ccfd - rustc_query_system::query::plumbing::ensure_query_impl::hfe99ea2efbe44936
  30:     0x7f67fc894636 - rustc_typeck::check::typeck_item_bodies::hf28dacb54d1499d4
  31:     0x7f67fc7ac7be - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute::h03b6a8389b40a3ef
  32:     0x7f67fc76f024 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::haf03bb47557a6c22
  33:     0x7f67fc7859a6 - rustc_data_structures::stack::ensure_sufficient_stack::hca9c5b34c52adf01
  34:     0x7f67fc8bc964 - rustc_query_system::query::plumbing::get_query_impl::h35e55d89fe2c8bdc
  35:     0x7f67fc7d4305 - rustc_typeck::check_crate::hab874d5f99f602e6
  36:     0x7f67fbd8f3f2 - rustc_interface::passes::analysis::h34f9b972d8af6f3d
  37:     0x7f67fbaec79b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h95ff81a8a73eaff3
  38:     0x7f67fbb7e6e6 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task::h3ea55e2ef223bb62
  39:     0x7f67fbb8dcc6 - rustc_data_structures::stack::ensure_sufficient_stack::ha70725b123b07fd9
  40:     0x7f67fbb1a4b4 - rustc_query_system::query::plumbing::get_query_impl::hcc63ca689fa3c69b
  41:     0x7f67fbaeea3b - rustc_interface::passes::QueryContext::enter::h2071e0a8631ee0e4
  42:     0x7f67fbb8b325 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hd899306a06575d0c
  43:     0x7f67fbb59217 - rustc_span::with_source_map::ha4e07ff263d0dc1d
  44:     0x7f67fbb870cc - scoped_tls::ScopedKey<T>::set::h39c0aa543118d3f3
  45:     0x7f67fbb8e576 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e5aa72fb9cd6d86
  46:     0x7f67fbaf67ea - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc793837e985b77ce
  47:     0x7f67fb2ac99a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/alloc/src/boxed.rs:1327:9
  48:     0x7f67fb2ac99a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/alloc/src/boxed.rs:1327:9
  49:     0x7f67fb2ac99a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/1f95c91c887acb2d0c49f549a07025178b818d87/library/std/src/sys/unix/thread.rs:71:17
  50:     0x7f67fb1a23e9 - start_thread
  51:     0x7f67fb0bf293 - __GI___clone
  52:                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.50.0-nightly (1f95c91c8 2020-12-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `Tr::fun`
#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 2 previous errors

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

@matthiaskrgr matthiaskrgr 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 Dec 3, 2020
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Dec 3, 2020

This crashes on master/nightly but not on rustc 1.49.0-beta.2 (bd26e4e54 2020-11-24)

@CraftSpider
Copy link
Contributor

This is an overlooked case for #78961, I can add it to the type-checking

@rustbot claim

@matthiaskrgr
Copy link
Member Author

I couldn't find a regression-from-beta-to-nightly label so using regression-from-stable-to-nightly
@rustbot label +regression-from-stable-to-nightly

@rustbot rustbot added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 3, 2020
@camelid
Copy link
Member

camelid commented Dec 3, 2020

How did this not get caught by CI?

@camelid camelid added requires-nightly This issue requires a nightly compiler in some way. P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 3, 2020
@camelid
Copy link
Member

camelid commented Dec 3, 2020

Assigning P-high and removing I-prioritize as discussed in the prioritization working group.

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Dec 4, 2020

How did this not get caught by CI?

I guess the original code (which triggers the ice) got changed. I found this by running todays rustc on the testcases from a couple of releases/years ago. :)

@CraftSpider
Copy link
Contributor

Yep, the test case was changed as part of the original PR. I didn't think to add the trait case to the new test, I've fixed that oversight (And one or two other possible cases) in the fix.

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 12, 2020
@camelid camelid added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jan 7, 2021
@camelid
Copy link
Member

camelid commented Jan 7, 2021

Regression is on beta now.

# for free to join this conversation on GitHub. Already have an account? # 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) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. requires-nightly This issue requires a nightly compiler in some way. 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.

6 participants