Skip to content

ICE when matching on DST structs. #23261

Closed
@hugoduncan

Description

@hugoduncan

The following code causes

Assertion failed: (getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"), function AssertOK, file /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/llvm/lib/IR/Instructions.cpp, line 1083.
use std::collections::HashMap;
use std::path::{Path, PathBuf};

#[derive(Debug)]
pub struct FileMeta;

struct S {
    h2 : HashMap<PathBuf, FileMeta>,
}

impl S {
    fn new() -> S {
        S {
            h2: HashMap::new(),
        }
    }

    fn f(&self, path: &Path) -> FileMeta {
        let m = FileMeta;
        match self.h2.get(path) {
            Some(meta) => m,
            None => m
        }
    }
}

Using rustc 1.0.0-nightly (12b846ab8 2015-03-09) (built 2015-03-09).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)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