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

Internal Compiler Error with neon-binding (https://github.com/neon-bindings/neon), Js-Rust Bindings #86071

Closed
Phil-Pa opened this issue Jun 6, 2021 · 3 comments
Labels
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.

Comments

@Phil-Pa
Copy link

Phil-Pa commented Jun 6, 2021

How to reproduce:

  • npm init neon cpu-count
  • cd cpu-count
  • copy the code below in src/main.rs

General Info

I know that code might not make any sense. I just wanted to try if I could do some multithreading with JavaScript by calling rust code from JS. But nethertheless I reported the error, because it could be useful. And I got 2 backtraces and pasted it.

Code

use std::{os::unix::prelude::JoinHandleExt, thread::JoinHandle, time::Duration};

use neon::prelude::*;

fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
    Ok(cx.string("hello node"))
}

static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;

fn start_thread(mut cx: FunctionContext) -> JsResult<JsNumber> {
    let handle = std::thread::spawn(move || {
        let mut i = 0u32;
        loop {
            std::thread::sleep(Duration::from_millis(300));
            i += 1;
            println!("{}", i);
        }
    });
    unsafe {
        global_handle = Some(handle);
    }
    Ok(cx.number(1f64))
}

#[neon::main]
fn main(mut cx: ModuleContext) -> NeonResult<()> {
    cx.export_function("hello", hello)?;
    Ok(())
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (b663c0f4f 2021-05-29)
binary: rustc
commit-hash: b663c0f4f6ff84a8c9df0f708e1f8d628330d973
commit-date: 2021-05-29
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0
$ RUST_BACKTRACE=1 cargo build
   Compiling cpu-count v0.1.0 (/home/phil/Documents/code/foo/cpu-count)
warning: unused import: `os::unix::prelude::JoinHandleExt`
 --> src/lib.rs:1:11
  |
1 | use std::{os::unix::prelude::JoinHandleExt, thread::JoinHandle, time::Duration};
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
 --> src/lib.rs:9:45
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  |                                             ^^^^^^^^^ help: use `dyn`: `dyn FnOnce(_)`
  |
  = note: `#[warn(bare_trait_objects)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
  = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>

warning: unnecessary `unsafe` block
  --> src/lib.rs:20:5
   |
20 |     unsafe {
   |     ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default

warning: static is never used: `global_handle`
 --> src/lib.rs:9:1
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: function is never used: `start_thread`
  --> src/lib.rs:11:4
   |
11 | fn start_thread(mut cx: FunctionContext) -> JsResult<JsNumber> {
   |    ^^^^^^^^^^^^

warning: static variable `global_handle` should have an upper case name
 --> src/lib.rs:9:12
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  |            ^^^^^^^^^^^^^ help: convert the identifier to upper case: `GLOBAL_HANDLE`
  |
  = note: `#[warn(non_upper_case_globals)]` on by default

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorReported', compiler/rustc_mir/src/monomorphize/collector.rs:884:84
stack backtrace:
   0: rust_begin_unwind
             at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/core/src/panicking.rs:92:14
   2: core::result::unwrap_failed
             at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/core/src/result.rs:1355:5
   3: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
   4: rustc_mir::monomorphize::collector::collect_neighbours
   5: rustc_mir::monomorphize::collector::collect_items_rec
   6: rustc_mir::monomorphize::collector::collect_items_rec
   7: rustc_mir::monomorphize::collector::collect_items_rec
   8: rustc_mir::monomorphize::collector::collect_items_rec
   9: rustc_mir::monomorphize::collector::collect_items_rec
  10: rustc_mir::monomorphize::collector::collect_items_rec
  11: rustc_session::utils::<impl rustc_session::session::Session>::time
  12: rustc_mir::monomorphize::collector::collect_crate_mono_items
  13: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  14: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::collect_and_partition_mono_items>::compute
  15: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::force_query_with_job
  19: rustc_query_system::query::plumbing::get_query_impl
  20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
  21: rustc_codegen_ssa::base::codegen_crate
  22: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  23: rustc_interface::passes::QueryContext::enter
  24: rustc_interface::queries::Queries::ongoing_codegen
  25: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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 (b663c0f4f 2021-05-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type cdylib

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

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
warning: 6 warnings emitted

Error output

error: internal compiler error: bad_placeholder_type
 --> src/lib.rs:9:52
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  |                                                    ^
  |
  = note: delayed at compiler/rustc_typeck/src/collect.rs:371:20

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/compiler/rustc_trait_selection/src/opaque_types.rs:942:32

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_typeck/src/check/coercion.rs:154:49

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:653:60

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/compiler/rustc_middle/src/ty/relate.rs:340:59

error: internal compiler error: cat_expr Errd
 --> src/lib.rs:9:59
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  |                                                           ^^^^
  |
  = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_typeck/src/check/expr.rs:879:22

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:714:27

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_infer/src/infer/sub.rs:124:31

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_typeck/src/check/coercion.rs:1269:42

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:11:64
   |
11 |   fn start_thread(mut cx: FunctionContext) -> JsResult<JsNumber> {
   |  ________________________________________________________________^
12 | |     let handle = std::thread::spawn(move || {
13 | |         let mut i = 0u32;
14 | |         loop {
...  |
23 | |     Ok(cx.number(1f64))
24 | | }
   | |_^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:12:18
   |
12 |       let handle = std::thread::spawn(move || {
   |  __________________^
13 | |         let mut i = 0u32;
14 | |         loop {
15 | |             std::thread::sleep(Duration::from_millis(300));
...  |
18 | |         }
19 | |     });
   | |______^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:12:18
   |
12 |     let handle = std::thread::spawn(move || {
   |                  ^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:12:37
   |
12 |       let handle = std::thread::spawn(move || {
   |  _____________________________________^
13 | |         let mut i = 0u32;
14 | |         loop {
15 | |             std::thread::sleep(Duration::from_millis(300));
...  |
18 | |         }
19 | |     });
   | |_____^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:12:45
   |
12 |       let handle = std::thread::spawn(move || {
   |  _____________________________________________^
13 | |         let mut i = 0u32;
14 | |         loop {
15 | |             std::thread::sleep(Duration::from_millis(300));
...  |
18 | |         }
19 | |     });
   | |_____^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:20:5
   |
20 | /     unsafe {
21 | |         global_handle = Some(handle);
22 | |     }
   | |_____^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:21:9
   |
21 |         global_handle = Some(handle);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:21:25
   |
21 |         global_handle = Some(handle);
   |                         ^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:21:25
   |
21 |         global_handle = Some(handle);
   |                         ^^^^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:21:30
   |
21 |         global_handle = Some(handle);
   |                              ^^^^^^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:21:9
   |
21 |         global_handle = Some(handle);
   |         ^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_typeck/src/check/regionck.rs:402:31

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_mir_build/src/build/mod.rs:777:18

error: internal compiler error: mir_const_qualif: MIR had errors
 --> src/lib.rs:9:1
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/transform/mod.rs:236:18

error: internal compiler error: PromoteTemps: MIR had errors
 --> src/lib.rs:9:1
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/transform/promote_consts.rs:51:22

error: internal compiler error: broken MIR in DefId(0:15 ~ cpu_count[e981]::global_handle) ("return type"): bad type [type error]
 --> src/lib.rs:9:1
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:252:27

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:721:20

error: internal compiler error: broken MIR in DefId(0:15 ~ cpu_count[e981]::global_handle) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: src/lib.rs:9:1: 9:64 (#0), scope: scope[0] } }): bad type [type error]
 --> src/lib.rs:9:1
  |
9 | static mut global_handle: Option<JoinHandle<FnOnce(_)>> = None;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:252:27

error: internal compiler error: PromoteTemps: MIR had errors
  --> src/lib.rs:11:1
   |
11 | fn start_thread(mut cx: FunctionContext) -> JsResult<JsNumber> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_mir/src/transform/promote_consts.rs:51:22

error: internal compiler error: broken MIR in DefId(0:16 ~ cpu_count[e981]::start_thread) ("return type"): bad type [type error]
  --> src/lib.rs:11:1
   |
11 | fn start_thread(mut cx: FunctionContext) -> JsResult<JsNumber> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:252:27

error: internal compiler error: broken MIR in DefId(0:16 ~ cpu_count[e981]::start_thread) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: src/lib.rs:11:1: 11:63 (#0), scope: scope[0] } }): bad type [type error]
  --> src/lib.rs:11:1
   |
11 | fn start_thread(mut cx: FunctionContext) -> JsResult<JsNumber> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:252:27

error: internal compiler error: PromoteTemps: MIR had errors
  --> src/lib.rs:12:37
   |
12 |       let handle = std::thread::spawn(move || {
   |  _____________________________________^
13 | |         let mut i = 0u32;
14 | |         loop {
15 | |             std::thread::sleep(Duration::from_millis(300));
...  |
18 | |         }
19 | |     });
   | |_____^
   |
   = note: delayed at compiler/rustc_mir/src/transform/promote_consts.rs:51:22

error: internal compiler error: broken MIR in DefId(0:17 ~ cpu_count[e981]::start_thread::{closure#0}) ("return type"): bad type [type error]
  --> src/lib.rs:12:37
   |
12 |       let handle = std::thread::spawn(move || {
   |  _____________________________________^
13 | |         let mut i = 0u32;
14 | |         loop {
15 | |             std::thread::sleep(Duration::from_millis(300));
...  |
18 | |         }
19 | |     });
   | |_____^
   |
   = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:252:27

error: internal compiler error: broken MIR in DefId(0:17 ~ cpu_count[e981]::start_thread::{closure#0}) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: src/lib.rs:12:37: 19:6 (#0), scope: scope[0] } }): bad type [type error]
  --> src/lib.rs:12:37
   |
12 |       let handle = std::thread::spawn(move || {
   |  _____________________________________^
13 | |         let mut i = 0u32;
14 | |         loop {
15 | |             std::thread::sleep(Duration::from_millis(300));
...  |
18 | |         }
19 | |     });
   | |_____^
   |
   = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:252:27

error: internal compiler error: encountered ambiguity selecting `Binder(<std::sync::Arc<std::cell::UnsafeCell<std::option::Option<std::result::Result<dyn std::ops::FnOnce([type error]), std::boxed::Box<dyn std::any::Any + std::marker::Send>>>>> as std::ops::Drop>, [])` during codegen, presuming due to overflow or prior type error
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:55:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1021:13
Backtrace

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1021:13
stack backtrace:
   0:     0x7fa44800b060 - std::backtrace_rs::backtrace::libunwind::trace::ha3c9a071e276aa0f
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fa44800b060 - std::backtrace_rs::backtrace::trace_unsynchronized::ha4cae02438775bee
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa44800b060 - std::sys_common::backtrace::_print_fmt::h7a4100df230ddc18
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fa44800b060 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h90c5a98ac3ece013
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fa448078a8c - core::fmt::write::h7aa6cd0067dca82a
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/core/src/fmt/mod.rs:1110:17
   5:     0x7fa447ffc8e5 - std::io::Write::write_fmt::h2fe56180f3d20a2a
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/io/mod.rs:1588:15
   6:     0x7fa44800eebb - std::sys_common::backtrace::_print::hfde54a51698eed27
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fa44800eebb - std::sys_common::backtrace::print::h2cdb1fdb4dae15b4
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fa44800eebb - std::panicking::default_hook::{{closure}}::h6b7f85bf6255ae64
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:208:50
   9:     0x7fa44800e991 - std::panicking::default_hook::h6033f351925c444f
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:225:9
  10:     0x7fa4487de72d - rustc_driver::report_ice::hedef9fb40338a23b
  11:     0x7fa43ae25e73 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h3393e4f052033350
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/alloc/src/boxed.rs:1589:9
  12:     0x7fa43ae23408 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h6c22bf08b3e8cdc8
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/proc_macro/src/bridge/client.rs:320:21
  13:     0x7fa44800f6c6 - std::panicking::rust_panic_with_hook::hde05f051c0c95c4a
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:626:17
  14:     0x7fa44800f1a7 - std::panicking::begin_panic_handler::{{closure}}::h49a1ef32b3e38727
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:519:13
  15:     0x7fa44800b55c - std::sys_common::backtrace::__rust_end_short_backtrace::hed2471df08b67583
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/sys_common/backtrace.rs:141:18
  16:     0x7fa44800f109 - rust_begin_unwind
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:515:5
  17:     0x7fa447fd7fcb - std::panicking::begin_panic_fmt::hf6913515f24c4986
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/panicking.rs:457:5
  18:     0x7fa44ac4a629 - rustc_errors::HandlerInner::flush_delayed::h3322626edccdc88d
  19:     0x7fa44ac490dd - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::he175ba8469a915c4
  20:     0x7fa44a2daf56 - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::h5c63f86f5df3788a
  21:     0x7fa44a2dd45e - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h11c57329750d41f3
  22:     0x7fa44a2ede6d - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::hb8a82cba31a9cf29
  23:     0x7fa44a2e3798 - rustc_span::with_session_globals::h6569bbb8a4ea9d61
  24:     0x7fa44a3078ff - std::sys_common::backtrace::__rust_begin_short_backtrace::h428dbdd434c4f112
  25:     0x7fa44a2de7b5 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hb7785b7f871527db
  26:     0x7fa44801bbb7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h79456d14677dd3c1
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/alloc/src/boxed.rs:1575:9
  27:     0x7fa44801bbb7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5c40c73501d779c0
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/alloc/src/boxed.rs:1575:9
  28:     0x7fa44801bbb7 - std::sys::unix::thread::Thread::new::thread_start::h55fc0fe77abc7cf7
                               at /rustc/b663c0f4f6ff84a8c9df0f708e1f8d628330d973/library/std/src/sys/unix/thread.rs:71:17
  29:     0x7fa447f42609 - start_thread
  30:     0x7fa447e56293 - clone
  31:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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 (b663c0f4f 2021-05-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type cdylib

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

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `cpu-count`

@Phil-Pa Phil-Pa 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 6, 2021
@jonas-schievink jonas-schievink added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 6, 2021
@hellow554
Copy link
Contributor

hellow554 commented Jun 7, 2021

@Phil-Pa you must edit src/lib.rs not src/main.rs.

@hellow554
Copy link
Contributor

MCVE:

use std::thread::JoinHandle;

static GLOBAL_HANDLE: Option<JoinHandle<FnOnce(_)>> = None;

fn main() {}

bisected to nightly-2020-05-03 7f65393...f05a524

seems to be a duplicate or at least related to #83630

@apiraino
Copy link
Contributor

apiraino commented Jun 9, 2021

closing then as duplicate (but please reopen if not the case, Zulip discussion)

@apiraino apiraino closed this as completed Jun 9, 2021
@JohnTitor JohnTitor removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 17, 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. 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

No branches or pull requests

5 participants