Skip to content

Borrowing a mutable explicit self pointer as immutable trips an LLVM assert #3357

Closed
@pcwalton

Description

@pcwalton

Test case:

struct Foo {
    x: int;
}

impl Foo {
    fn f(&self) {}
}

fn g(x: &mut Foo) {
    x.f();
}

fn main() {
}

Error:

rustc: /home/pcwalton/Source/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.

@nikomatsakis, any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsI-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