Skip to content

LLVM assertion failed in code with closures #20193

Closed
@netvl

Description

@netvl

This code (as reported in this SO question):

fn foo(t: &mut int){
    println!("{}", t);
}

fn main() {
    let test = 10;

    let h = move || {
        let mut r = &mut test.clone();
        foo(r);
    };

    h();
}

causes an assertion failure in LLVM code:

Assertion failed: (S->getType()->isPtrOrPtrVectorTy() && "Invalid cast"), function CreatePointerCast, file /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/llvm/lib/IR/Instructions.cpp, line 2522.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions