Skip to content

LLVM assertion when compiling with -g #19575

Closed
@Kintaro

Description

@Kintaro

@bstrie So, this code raises an assertion in llvm when compiling with -g. Without -g it works fine.

#![feature(unboxed_closures)]

pub struct A;

impl A {
    pub fn foo(&self, f: Box<Fn<(), ()> + 'static>) ->
            Box<Fn<(), ()> + 'static> {
        (box move |&:| {
            (*f).call(())
        })
    }
}

Raised assertion is

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/llvm/lib/IR/Instructions.cpp:1086: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
[1]    1800 abort (core dumped)  rustc --crate-type lib test.rs -g

Edit: reduced code more

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-closuresArea: Closures (`|…| { … }`)A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions