Skip to content

extern "Rust" causes ICE #29115

Closed
Closed
@emoon

Description

@emoon

I tried this code

extern "Rust" {
    fn foo();
}

pub extern fn bar() {
    unsafe {
        foo();
    }
}

I get this error back

error: internal compiler error: unimplemented foreign functions with Rust ABI
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
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:253

With this callstack

stack backtrace:
   1:        0x107896df0 - sys::backtrace::tracing::imp::write::hcc30a3eadf7eacbaY7s
   2:        0x107894199 - panicking::on_panic::h4d2fd0b9d2c3a9dawWw
   3:        0x10785d722 - sys_common::unwind::begin_unwind_inner::h422f2d558d1128f5vas
   4:        0x105571e0a - sys_common::unwind::begin_unwind::h16591736175787396598
   5:        0x1055734b7 - diagnostic::Handler::bug::h5eb8658877061d7fBUA
   6:        0x10557355d - diagnostic::Handler::unimpl::hf8c4f36c7ae3921deVA
   7:        0x104bf50c6 - session::Session::unimpl::h80333f3c32b7424aNTv
   8:        0x1041aef09 - trans::foreign::llvm_calling_convention::h62e2347762be1b10P1E
   9:        0x1040bf06b - trans::foreign::register_foreign_item_fn::haab078061d88b341S6E
  10:        0x1040e4037 - trans::base::get_item_val::h8a4e5e51f0e6a9b5dNj
  11:        0x10410656b - trans::callee::trans_fn_ref_with_substs::h25cc9af7cdd3d639GSo
  12:        0x104104c3f - trans::callee::trans_fn_ref::hbaeedb0dccc4c5ec3Ho
  13:        0x104101e8a - trans::callee::trans::hb3149cb68141d07cOwo
  14:        0x104118acd - trans::callee::trans_call_inner::h2380022227104993647
  15:        0x10418e519 - trans::expr::trans_rvalue_dps_unadjusted::h47eea2c10cea0d3a1UC
  16:        0x1040df73b - trans::expr::trans_into::he5140b80c0fcc596ALB
  17:        0x10415c301 - trans::controlflow::trans_stmt_semi::hdbb8c3363dccaa4dAow
  18:        0x1040dbbd0 - trans::controlflow::trans_block::h7598f29562d95fecwpw
  19:        0x10418d951 - trans::expr::trans_rvalue_dps_unadjusted::h47eea2c10cea0d3a1UC
  20:        0x1040df73b - trans::expr::trans_into::he5140b80c0fcc596ALB
  21:        0x1040dbf0b - trans::controlflow::trans_block::h7598f29562d95fecwpw
  22:        0x1040dada0 - trans::base::trans_closure::he8bf1aef27541010vQi
  23:        0x1040dc48e - trans::base::trans_fn::h5caff2a66a07b5e0i0i
  24:        0x1040e5045 - trans::foreign::trans_rust_fn_with_foreign_abi::h376072a31bc4e8c9sIF
  25:        0x1040e0418 - trans::base::trans_item::h3455dd2df4186aa69qj
  26:        0x1040edb16 - trans::base::trans_crate::h153b706938fe137dvfk
  27:        0x103ceee90 - driver::phase_4_translate_to_llvm::ha368427a3150e061lPa
  28:        0x103ce9533 - driver::phase_3_run_analysis_passes::closure.21572
  29:        0x103cc5e8a - middle::ty::context::ctxt<'tcx>::create_and_enter::h280010008062703679
  30:        0x103cc1833 - driver::phase_3_run_analysis_passes::h7966677709961029738
  31:        0x103ca1e06 - driver::compile_input::hbe0080b64502a8450ba
  32:        0x103e05100 - run_compiler::h47f56d2126b6decaqqc
  33:        0x103e0295b - boxed::F.FnBox<A>::call_box::h7389904371439365875
  34:        0x103e02262 - sys_common::unwind::try::try_fn::h17815137062015229953
  35:        0x107893a78 - __rust_try
  36:        0x1078884b0 - sys_common::unwind::try::inner_try::h3228b1bed896cdc3T6r
  37:        0x103e02412 - boxed::F.FnBox<A>::call_box::h9302258747750698854
  38:        0x10789c31d - sys::thread::Thread::new::thread_start::h770a3938c0de9490puw
  39:     0x7fff916b99b0 - _pthread_body
  40:     0x7fff916b992d - _pthread_start

Compiler version

rustc 1.4.0-beta.2 (4b9b1f3b0 2015-10-01)
binary: rustc
commit-hash: 4b9b1f3b0fe6cd99e1e929b7def63c37f286f335
commit-date: 2015-10-01
host: x86_64-apple-darwin
release: 1.4.0-beta.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions