Skip to content

matching on &'static str triggers "assertion failed" #11237

Closed
@pfalabella

Description

@pfalabella

I was trying to get a hang of how pattern matching works with constants and I may have hit a bug.

Rust nighlty on windows: rustc.exe 0.9-pre (b5b570b 2013-12-29
18:46:57 -0800)
host: i686-pc-mingw32

static TEST: &'static str = &"paolo";
let myVar = "paolo";

let rt = match myVar {  
    TEST => "it's me",
    _ => "not me"
};

println(rt);

I get
$ rustc test.rs
Assertion failed: (i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]-> getType()) && "Calling a function with a bad signature!", file d:/Heather/Contrib/P/rust/src/llvm/lib/IR/Instructions.cpp, line 281

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-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