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: When creating Box<FnOnce<(), ()>> from unsugared unboxed closure #16739

Closed
japaric opened this issue Aug 24, 2014 · 1 comment
Closed

ICE: When creating Box<FnOnce<(), ()>> from unsugared unboxed closure #16739

japaric opened this issue Aug 24, 2014 · 1 comment
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@japaric
Copy link
Member

japaric commented Aug 24, 2014

STR

#![feature(unboxed_closures)]

struct Foo;

impl FnOnce<(), ()> for Foo {
    extern "rust-call" fn call_once(self, _: ()) {}
}

fn main() {
    // OK
    let _ = (box |:| {}) as Box<FnOnce<(), ()>>;

    // ICE
    let _ = box Foo as Box<FnOnce<(), ()>>;
}

Backtrace

task 'rustc' failed at 'assertion failed: index < LLVMCountParams(llfn)', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/librustc_llvm/lib.rs:2041

stack backtrace:
   1:     0x7fb7eeb3f480 - rt::backtrace::imp::write::h1152902d41e3d933UYq
   2:     0x7fb7eeb42630 - <unknown>
   3:     0x7fb7f3090710 - unwind::begin_unwind_inner::h2d2ade2676f09803pie
   4:     0x7fb7ef24a4d0 - <unknown>
   5:     0x7fb7ef24a460 - get_param::hb758eec3c648c233Hxc
   6:     0x7fb7f3ab0ce0 - middle::trans::callee::trans_unboxing_shim::h2a20a0dc6bd6bcaa4l0
   7:     0x7fb7f3b697f0 - <unknown>
   8:     0x7fb7f3b6bbf0 - <unknown>
   9:     0x7fb7f3ac7830 - middle::trans::meth::trans_trait_cast::h072d1f530eebabfeFCj
  10:     0x7fb7f3ac4060 - <unknown>
  11:     0x7fb7f3ac3270 - <unknown>
  12:     0x7fb7f3a86270 - middle::trans::expr::trans::h747aacd7f3710e8boL1
  13:     0x7fb7f3a84a20 - middle::trans::expr::trans_to_lvalue::hb541e6a03a8e3d09Z31
  14:     0x7fb7f3b24b60 - middle::trans::_match::store_local::he57e710125ac8569PCg
  15:     0x7fb7f3a84180 - middle::trans::base::init_local::hfb093aefcbfd1663agc
  16:     0x7fb7f3a83790 - middle::trans::controlflow::trans_stmt::hb90be18b35bbdabdVUX
  17:     0x7fb7f3a850f0 - middle::trans::controlflow::trans_block::h29d3e959287f28066ZX
  18:     0x7fb7f3b2d0f0 - middle::trans::base::trans_closure::h9d2ca2e9b802af5cF8c
  19:     0x7fb7f3a76880 - middle::trans::base::trans_fn::h7d4da3ce8c357bcdskd
  20:     0x7fb7f3a71e80 - middle::trans::base::trans_item::hc24a7b2fa4f20f13sCd
  21:     0x7fb7f3b37790 - middle::trans::base::trans_crate::h3769d84143898d672we
  22:     0x7fb7f3efcd50 - driver::driver::phase_4_translate_to_llvm::h4b21525153d39d62Z1w
  23:     0x7fb7f3ef4030 - driver::driver::compile_input::hed1faeda6eed200dqEw
  24:     0x7fb7f3f88100 - <unknown>
  25:     0x7fb7f3f88010 - <unknown>
  26:     0x7fb7f3f99ee0 - <unknown>
  27:     0x7fb7f3f99ce0 - <unknown>
  28:     0x7fb7f33e8e80 - <unknown>
  29:     0x7fb7f30e09f0 - <unknown>
  30:     0x7fb7f30e09e0 - rust_try
  31:     0x7fb7f308dd80 - unwind::try::hb0f99c41baa56e2aF6d
  32:     0x7fb7f308db20 - task::Task::run::hf1685016641f31daZcd
  33:     0x7fb7f33e8c40 - <unknown>
  34:     0x7fb7f308f960 - <unknown>
  35:     0x7fb7edec1000 - start_thread
  36:     0x7fb7f2d5d269 - clone
  37:                0x0 - <unknown>

Version

rustc 0.12.0-pre (5ad7afc2d 2014-08-24 11:16:02 +0000)

cc @pcwalton

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 22, 2014
@aturon aturon mentioned this issue Oct 16, 2014
47 tasks
@bkoropoff
Copy link
Contributor

Generating the unboxing shim chokes on the rust-call ABI. Attempting to fix.

bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 17, 2014
bors added a commit that referenced this issue Oct 18, 2014
When translating the unboxing shim, account for the fact that the shim translation has already performed the necessary unboxing of input types and values when forwarding to the shimmed function.  This prevents ICEing or generating incorrect code.

Closes #16739
@bors bors closed this as completed in 4a4a434 Oct 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants