Skip to content

LLVM assertion failure while compiling boxed iterator #20989

Closed
@ebfull

Description

@ebfull
#![allow(dead_code)]

#[derive(Show)]
struct Cell;

struct Grid {
    cols: [[Cell; 6]; 6]
}

impl Grid {
    fn iter(&self) -> Box<Iterator<Item = &Cell>> {
        Box::new(self.cols.iter().flat_map(|x| x.iter()))
    }
    fn fill(&mut self) {
        for cell in *self.iter() {
            println!("here's a cell: {:?}", cell);
        }
    }
}

fn main() {
}

Error and backtrace:

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:550: void llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&): Assertion (i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Invoking a function with a bad signature!"' failed.`

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffefbff700 (LWP 4538)]
0x00007ffff711e107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff711e107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff711f4e8 in __GI_abort () at abort.c:89
#2  0x00007ffff7117226 in __assert_fail_base (fmt=0x7ffff724d968 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0x7ffff4bec220 "(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && \"Invoking a function with a bad signature!\"",
    file=file@entry=0x7ffff4bea228 "/home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp", line=line@entry=550,
    function=function@entry=0x7ffff4beda20 <llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&)::__PRETTY_FUNCTION__> "void llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&)") at assert.c:92
#3  0x00007ffff71172d2 in __GI___assert_fail (assertion=0x7ffff4bec220 "(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && \"Invoking a function with a bad signature!\"",
    file=0x7ffff4bea228 "/home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp", line=550,
    function=0x7ffff4beda20 <llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&)::__PRETTY_FUNCTION__> "void llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&)") at assert.c:101
#4  0x00007ffff419be6d in llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#5  0x00007ffff319a6e1 in llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateInvoke(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) ()
   from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#6  0x00007ffff40e28ce in LLVMBuildInvoke () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#7  0x00007ffff6569050 in trans::base::invoke::h4cd8ec174fe38a29DTs () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#8  0x00007ffff65dcba1 in trans::callee::trans_call_inner::h2302436840455011871 () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#9  0x00007ffff65a4bc0 in trans::expr::trans_rvalue_stmt_unadjusted::h3e17f3a20f297c29BMi () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#10 0x00007ffff6553bbe in trans::expr::trans_into::ha60adcbe08fa3bdbKyh () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#11 0x00007ffff65545d1 in trans::controlflow::trans_block::hdd6a1a94b7524b90B3d () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#12 0x00007ffff66226ad in trans::base::trans_closure::h1947fd5123bfe895EYt () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#13 0x00007ffff653ede7 in trans::base::trans_fn::h5d061f11fc4ac1e7j9t () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#14 0x00007ffff653b00f in trans::base::trans_item::h34ec82732f0498f3Ewu () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#15 0x00007ffff6628dad in trans::base::trans_crate::he5ffa45aaa619f67lsv () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#16 0x00007ffff7aef844 in driver::phase_4_translate_to_llvm::h98aea3c7bb04643bPFa () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#17 0x00007ffff7acb49d in driver::compile_input::h04aea004c559b910xba () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#18 0x00007ffff7b9a96a in monitor::unboxed_closure.22497 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#19 0x00007ffff7b98f82 in thunk::F.Invoke$LT$A$C$$u{20}R$GT$::invoke::h11849311349984608396 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#20 0x00007ffff7b97c6f in rt::unwind::try::try_fn::h13617610205470131813 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#21 0x00007ffff76196c9 in rust_try_inner () from /usr/local/lib/libstd-4e7c5e5c.so
#22 0x00007ffff76196b6 in rust_try () from /usr/local/lib/libstd-4e7c5e5c.so
#23 0x00007ffff7b98386 in thunk::F.Invoke$LT$A$C$$u{20}R$GT$::invoke::h14452289732390470265 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#24 0x00007ffff75a19b2 in sys::thread::thread_start::h93b0d38960a9fcacqrw () from /usr/local/lib/libstd-4e7c5e5c.so
#25 0x00007ffff1b510a4 in start_thread (arg=0x7fffefbff700) at pthread_create.c:309
#26 0x00007ffff71ceccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

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