Skip to content

LLVM assertion error when dereferencing "&mut Iterator<Item=Something>" from function parameter #21379

Closed
@mottalli

Description

@mottalli

Offending code:

extern crate core;
use core::fmt;

fn show_all<I: fmt::String>(iter: &mut Iterator<Item=I>) {
    for i in *iter {
        println!("{}", i);
    }
}

fn main() {
    let v = vec![1i32, 2, 3, 4];
    show_all(&mut v.iter());
}

Compiler error (formatted):

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

Rust version:

$ rustc --version
rustc 1.0.0-nightly (f4f10dba2 2015-01-17 20:31:08 +0000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)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