Skip to content

ICE on implementing a trait with an extern "rust-call" function #19397

Closed
@ftxqxd

Description

@ftxqxd
trait Foo {
    extern "rust-call" fn foo();
}

impl Foo for () {
    extern "rust-call" fn foo() {}
}

fn main() {}
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc_trans/lib.rs:1

stack backtrace:
   1:     0x7f026d48e3b0 - rt::backtrace::imp::write::h753be74b825f61ed19x
   2:     0x7f026d491480 - failure::on_fail::h7418e5cabf6c549ekCy
   3:     0x7f026d0e7320 - unwind::begin_unwind_inner::h21b15480bba8536c0Qc
   4:     0x7f026d0e6f60 - unwind::begin_unwind_fmt::ha54d70607579ef16bOc
   5:     0x7f026d0e6f20 - rust_begin_unwind
   6:     0x7f026d12c7e0 - panicking::panic_fmt::h144ed295ee75bac8VXl
   7:     0x7f026d131c20 - panicking::panic_bounds_check::h46462e0c27f8d7d1tWl
   8:     0x7f026d9e7650 - trans::base::get_fn_llvm_attributes::hc0b3d585a75ed3e7jkv
   9:     0x7f026d9e6410 - trans::base::decl_rust_fn::hdb49e69d8957a677rCs
  10:     0x7f026d9fccf0 - trans::base::register_fn::hac5d473a4e5c818bxiv
  11:     0x7f026d9ff890 - trans::base::register_method::he6d8d1dc781b7af2cZv
  12:     0x7f026d933d70 - trans::base::get_item_val::h07c1542a8cc17e2c7Gv
  13:     0x7f026d9faa00 - trans::meth::trans_impl::h7ce660493050c3ceX8z
  14:     0x7f026d932690 - trans::base::trans_item::h4f3b35bce9ae51243av
  15:     0x7f026d9fb160 - trans::base::trans_mod::h18114d50e28ae38eygv
  16:     0x7f026da01f80 - trans::base::trans_crate::hc608c93243bdc3cfn9v
  17:     0x7f026daaead0 - driver::driver::phase_4_translate_to_llvm::ha275ee9ba36f38d9PvS
  18:     0x7f026da9c2f0 - driver::driver::compile_input::h342f6a27db36679d12R
  19:     0x7f026db20280 - driver::run_compiler::h817060b002a7c16090T
  20:     0x7f026db20170 - driver::run::closure.59904
  21:     0x7f026d927d10 - task::TaskBuilder::try_future::closure.39020
  22:     0x7f026d45f010 - task::TaskBuilder::spawn_internal::closure.30320
  23:     0x7f026d0e5100 - task::Task::spawn::closure.5727
  24:     0x7f026d13f470 - rust_try_inner
  25:     0x7f026d13f460 - rust_try
  26:     0x7f026d0e51e0 - unwind::try::h75fe9090402d7736lFc
  27:     0x7f026d0e4fa0 - task::Task::run::h1f2cd4b02103da7aeOb
  28:     0x7f026d0e4b90 - task::Task::spawn::closure.5703
  29:     0x7f026d0e65e0 - thread::thread_start::h60b7b4aa191da867h6b
  30:     0x7f0267e4d0c0 - start_thread
  31:     0x7f026cdabf89 - __clone
  32:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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