Skip to content

ref pattern nested inside let LHS causes LLVM assertion failure #3874

Closed
@nejucomo

Description

@nejucomo

The following code (which may not be correct rust) causes an llvm abort on my build.

$ cat ./experiment.rs

enum PureCounter { PureCounter(uint) }

impl PureCounter : iter::BaseIter<uint> {
    pure fn each(blk: fn(v: &uint) -> bool) {
        let PureCounter(ref x) = self;
        match blk(x) {
          true => PureCounter( (*x) + 1 ).each(blk),
          false => ()
        }
    }

    pure fn size_hint() -> Option<uint> { None }
}

fn main() {
    do PureCounter(0).each |nbox| {
        io::println( (*nbox).to_str() );
        (*nbox) < 5
    }
}

$ rustc ./experiment.rs
rustc: /home/n/sandbox/3p/rust/src/llvm/lib/VMCore/Instructions.cpp:1062: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
Aborted

$ rustc --version
rustc 0.5 (07edf90 2012-10-13 05:57:13 -0700)
host: x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationI-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