Skip to content

Ptr must be a pointer to a Val type LLVM error #10674

Closed
@alexjg

Description

@alexjg

I'm using rust 0.8 on Arch Linux 64 bit.

The following program

use std::hashmap::HashMap;

struct SomeStruct<'self> {
    field : ~HashMap<int, &'self Map<int, ~str>>
}

fn main() {
    let mut mapone : HashMap<int, ~str> = HashMap::new();
    mapone.insert(3, ~"somestring");
    let mut maptwo : ~HashMap<int, &Map<int, ~str>> = ~HashMap::new();
    maptwo.insert(3, &mapone as &Map<int, ~str>);
    let val = SomeStruct{
        field: maptwo
    };
    return ();
}

Gives this error on compiling

rustc: /build/rust/src/rust-0.8/src/llvm/lib/IR/Instructions.cpp:1084: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
[1]    8199 abort (core dumped)  rustc failure.rs

I'm probably doing something wrong as I'm still a rust newbie but the error message isn't very helpful.

Metadata

Metadata

Assignees

No one assigned

    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